Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
Freddyminu committed Nov 13, 2024
1 parent 2c43c85 commit 8a61b9d
Show file tree
Hide file tree
Showing 4 changed files with 268 additions and 244 deletions.
2 changes: 1 addition & 1 deletion decoders/connector/khomp/its-402/connector.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"versions": {
"v1.0.0": {
"src": "./v1.0.0/payload.js",
"src": "./v1.0.0/payload.ts",
"manifest": "./v1.0.0/payload-config.jsonc"
}
}
Expand Down
243 changes: 0 additions & 243 deletions decoders/connector/khomp/its-402/v1.0.0/payload.js

This file was deleted.

26 changes: 26 additions & 0 deletions decoders/connector/khomp/its-402/v1.0.0/payload.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable unicorn/numeric-separators-style */
import { describe, expect, test } from "vitest";

import { decoderRun } from "../../../../../src/functions/decoder-run";

const file_path = "/decoders/connector/khomp/its-402/v1.0.0/payload.ts" as const;

describe("The data below should not be parsed", () => {
let payload = [
{ variable: "Temperature", value: "04096113950292" },
{ variable: "fport", value: 9 },
];

let device = { params: [{ key: "language", value: "EN" }] };
payload = decoderRun(file_path, { payload, device });
test("Output Result", () => {
expect(Array.isArray(payload)).toBe(true);
});

test("Not parsed Result", () => {
expect(payload).toEqual([
{ variable: "Temperature", value: "04096113950292" },
{ variable: "fport", value: 9 },
]);
});
});
Loading

0 comments on commit 8a61b9d

Please sign in to comment.