Skip to content

Commit

Permalink
Merge pull request #95 from tago-io/fix/connector-khomp-itg-402
Browse files Browse the repository at this point in the history
Adding condition checking if a payload is a device uplink.
  • Loading branch information
FabianoEger authored Nov 13, 2024
2 parents 30a8f1d + 8a61b9d commit d4ed580
Show file tree
Hide file tree
Showing 4 changed files with 268 additions and 236 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
235 changes: 0 additions & 235 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 d4ed580

Please sign in to comment.