Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding condition checking if a payload is a device uplink. #95

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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