Refactored extras field parsing

This commit is contained in:
2026-03-18 18:22:53 +01:00
parent 6adf1281ef
commit e9e329ccc1
3 changed files with 166 additions and 95 deletions

View File

@@ -110,7 +110,7 @@ describe("APRS extras test vectors", () => {
const commentSeg = structure.find((s) => /comment/i.test(String(s.name))) as Segment | undefined;
expect(commentSeg).toBeDefined();
const fieldsRNG = (commentSeg!.fields ?? []) as Field[];
const hasRNG = fieldsRNG.some((f) => f.name === "RNG marker");
const hasRNG = fieldsRNG.some((f) => f.name === "range marker");
expect(hasRNG).toBe(true);
});
});

View File

@@ -950,7 +950,7 @@ describe("Packet dissection with sections", () => {
const commentSection = result.structure?.find((s) => s.name === "comment");
expect(commentSection).toBeDefined();
expect(commentSection?.data?.byteLength).toBe("Test message".length);
expect(commentSection?.fields?.[0]?.name).toBe("text");
expect(commentSection?.fields?.[0]?.name).toBe("comment");
});
});