tests still calling, but not testing anything
This commit is contained in:
parent
cb34c835a6
commit
d747fc9769
@ -15,8 +15,6 @@ export default function parseTransducer(content, accuracy){
|
|||||||
// Split the content into sections based on the blank line
|
// Split the content into sections based on the blank line
|
||||||
const sections = content.trim().split("\n\n");
|
const sections = content.trim().split("\n\n");
|
||||||
|
|
||||||
debugger
|
|
||||||
|
|
||||||
for (const section of sections) {
|
for (const section of sections) {
|
||||||
// Split each section into lines
|
// Split each section into lines
|
||||||
const lines = section.trim().split("\n");
|
const lines = section.trim().split("\n");
|
||||||
@ -27,15 +25,16 @@ export default function parseTransducer(content, accuracy){
|
|||||||
|
|
||||||
// Extract the Transducer number and Transducer type
|
// Extract the Transducer number and Transducer type
|
||||||
const transducerLine = filteredLines.shift().trim();
|
const transducerLine = filteredLines.shift().trim();
|
||||||
const [_, transducerName, partNumber] = transducerLine.split(null, 2);
|
let [transducerName, partNumber] = transducerLine.split(/\s\s+/);
|
||||||
|
|
||||||
// Get part number and values
|
// Get part number and values
|
||||||
let value = null;
|
let value = null;
|
||||||
let unit = null;
|
let unit = null;
|
||||||
let transducerType = null;
|
let transducerType = null;
|
||||||
if (partNumber !== "Custom") {
|
if (partNumber !== "Custom") {
|
||||||
value = partNumber.split(" ").pop();
|
partNumber = partNumber.split(" ")
|
||||||
partNumber = partNumber.split(" ")[1];
|
value = partNumber.pop();
|
||||||
|
partNumber = partNumber.join(" ");
|
||||||
const match = value.match(/([0-9]+)([A-Z]+)/i);
|
const match = value.match(/([0-9]+)([A-Z]+)/i);
|
||||||
if (match) {
|
if (match) {
|
||||||
[, value, unit] = match;
|
[, value, unit] = match;
|
||||||
@ -73,7 +72,7 @@ export default function parseTransducer(content, accuracy){
|
|||||||
transducerInfo["Verify Time"] = val;
|
transducerInfo["Verify Time"] = val;
|
||||||
} else {
|
} else {
|
||||||
// Toss anything else where it belongs
|
// Toss anything else where it belongs
|
||||||
const [, cleanKey] = key.split(/\W\d/);
|
const [cleanKey, _] = key.split(/\W\d/);
|
||||||
if (
|
if (
|
||||||
cleanKey in transducerInfo ||
|
cleanKey in transducerInfo ||
|
||||||
key.includes(`Instrument ${transducerType}`)
|
key.includes(`Instrument ${transducerType}`)
|
||||||
|
@ -4,5 +4,6 @@ import parseTransducer from "../Transducer"
|
|||||||
const file = fs.readFileSync("src/parsers/__tests__/transducer_verify.txt", 'utf8')
|
const file = fs.readFileSync("src/parsers/__tests__/transducer_verify.txt", 'utf8')
|
||||||
|
|
||||||
test('Check if 1 equals 1', () => {
|
test('Check if 1 equals 1', () => {
|
||||||
parseTransducer(file, 0.05)
|
const transducer = parseTransducer(file, 0.05)
|
||||||
|
console.log(transducer)
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user