Also parse the extras from the comment field

This commit is contained in:
2026-03-18 13:11:16 +01:00
parent 78dbd3b0ef
commit b1cd8449d9
16 changed files with 754 additions and 493 deletions

View File

@@ -1,12 +1,12 @@
import { describe, it, expect } from "vitest";
import { Dissected } from "@hamradio/packet";
import { describe, expect, it } from "vitest";
import { Frame } from "../src/frame";
import { DataType, type RawGPSPayload } from "../src/frame.types";
import { Dissected } from "@hamradio/packet";
describe("Raw GPS decoding", () => {
it("decodes simple NMEA sentence as raw-gps payload", () => {
const sentence =
"GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A";
const sentence = "GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A";
const frameStr = `SRC>DEST:$${sentence}`;
const f = Frame.parse(frameStr);
@@ -21,8 +21,7 @@ describe("Raw GPS decoding", () => {
});
it("returns structure when requested", () => {
const sentence =
"GPGGA,092750.000,5321.6802,N,00630.3372,W,1,08,1.0,73.0,M,0.0,M,,*6A";
const sentence = "GPGGA,092750.000,5321.6802,N,00630.3372,W,1,08,1.0,73.0,M,0.0,M,,*6A";
const frameStr = `SRC>DEST:$${sentence}`;
const f = Frame.parse(frameStr);
@@ -40,9 +39,7 @@ describe("Raw GPS decoding", () => {
expect(result.structure).toBeDefined();
const rawSection = result.structure.find((s) => s.name === "raw-gps");
expect(rawSection).toBeDefined();
const posSection = result.structure.find(
(s) => s.name === "raw-gps-position",
);
const posSection = result.structure.find((s) => s.name === "raw-gps-position");
expect(posSection).toBeDefined();
});
});