Skip to content

Commit

Permalink
test: add test file
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbutt committed Feb 23, 2024
1 parent ba715be commit af80848
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 23 deletions.
136 changes: 136 additions & 0 deletions tests/app.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import { describe, it, expect } from "vitest";
import CrestronCH5, {
AnalogEvent,
AnalogState,
DigitalEvent,
DigitalState,
SerialEvent,
SerialState,
SignalType,
} from "../src/index.js";

describe("Crestron CH5 Helper", () => {
it("should import default export without error", () => {
expect(CrestronCH5).toBeDefined();
});

describe("ReservedJoin", () => {
describe("Analog", () => {
describe("Event", () => {
it("should contain the correct values", () => {
for (const key of Object.keys(
CrestronCH5.ReservedJoin.Analog.Event,
)) {
const value = key.replace(/^Csig_/, "Csig.");

expect(
CrestronCH5.ReservedJoin.Analog.Event[
key as keyof typeof AnalogEvent
],
).toBe(value);
}
});
});

describe("State", () => {
it("should contain the correct values", () => {
for (const key of Object.keys(
CrestronCH5.ReservedJoin.Analog.State,
)) {
const value = key.replace(/^Csig_/, "Csig.");

expect(
CrestronCH5.ReservedJoin.Analog.State[
key as keyof typeof AnalogState
],
).toBe(value);
}
});
});
});

describe("Digital", () => {
describe("Event", () => {
it("should contain the correct values", () => {
for (const key of Object.keys(
CrestronCH5.ReservedJoin.Digital.Event,
)) {
const value = key.replace(/^Csig_/, "Csig.");

expect(
CrestronCH5.ReservedJoin.Digital.Event[
key as keyof typeof DigitalEvent
],
).toBe(value);

Check failure on line 64 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > ReservedJoin > Digital > Event > should contain the correct values

AssertionError: expected 'Csig.Browser_kiosk_off' to be 'Csig.Browser_Kiosk_Off' // Object.is equality - Expected + Received - Csig.Browser_Kiosk_Off + Csig.Browser_kiosk_off ❯ tests/app.test.ts:64:27

Check failure on line 64 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 20.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > ReservedJoin > Digital > Event > should contain the correct values

AssertionError: expected 'Csig.Browser_kiosk_off' to be 'Csig.Browser_Kiosk_Off' // Object.is equality - Expected + Received - Csig.Browser_Kiosk_Off + Csig.Browser_kiosk_off ❯ tests/app.test.ts:64:27

Check failure on line 64 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > ReservedJoin > Digital > Event > should contain the correct values

AssertionError: expected 'Csig.Browser_kiosk_off' to be 'Csig.Browser_Kiosk_Off' // Object.is equality - Expected + Received - Csig.Browser_Kiosk_Off + Csig.Browser_kiosk_off ❯ tests/app.test.ts:64:27

Check failure on line 64 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 20.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > ReservedJoin > Digital > Event > should contain the correct values

AssertionError: expected 'Csig.Browser_kiosk_off' to be 'Csig.Browser_Kiosk_Off' // Object.is equality - Expected + Received - Csig.Browser_Kiosk_Off + Csig.Browser_kiosk_off ❯ tests/app.test.ts:64:27
}
});
});

describe("State", () => {
it("should contain the correct values", () => {
for (const key of Object.keys(
CrestronCH5.ReservedJoin.Digital.State,
)) {
const value = key.replace(/^Csig_/, "Csig.");

expect(
CrestronCH5.ReservedJoin.Digital.State[
key as keyof typeof DigitalState
],
).toBe(value);

Check failure on line 80 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > ReservedJoin > Digital > State > should contain the correct values

AssertionError: expected 'Csig.Browser_kiosk_off_fb' to be 'Csig.Browser_Kiosk_Off_fb' // Object.is equality - Expected + Received - Csig.Browser_Kiosk_Off_fb + Csig.Browser_kiosk_off_fb ❯ tests/app.test.ts:80:27

Check failure on line 80 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 20.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > ReservedJoin > Digital > State > should contain the correct values

AssertionError: expected 'Csig.Browser_kiosk_off_fb' to be 'Csig.Browser_Kiosk_Off_fb' // Object.is equality - Expected + Received - Csig.Browser_Kiosk_Off_fb + Csig.Browser_kiosk_off_fb ❯ tests/app.test.ts:80:27

Check failure on line 80 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > ReservedJoin > Digital > State > should contain the correct values

AssertionError: expected 'Csig.Browser_kiosk_off_fb' to be 'Csig.Browser_Kiosk_Off_fb' // Object.is equality - Expected + Received - Csig.Browser_Kiosk_Off_fb + Csig.Browser_kiosk_off_fb ❯ tests/app.test.ts:80:27

Check failure on line 80 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 20.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > ReservedJoin > Digital > State > should contain the correct values

AssertionError: expected 'Csig.Browser_kiosk_off_fb' to be 'Csig.Browser_Kiosk_Off_fb' // Object.is equality - Expected + Received - Csig.Browser_Kiosk_Off_fb + Csig.Browser_kiosk_off_fb ❯ tests/app.test.ts:80:27
}
});
});
});

describe("Serial", () => {
describe("Event", () => {
it("should contain the correct values", () => {
for (const key of Object.keys(
CrestronCH5.ReservedJoin.Serial.Event,
)) {
const value = key.replace(/^Csig_/, "Csig.");

expect(
CrestronCH5.ReservedJoin.Serial.Event[
key as keyof typeof SerialEvent
],
).toBe(value);
}
});
});

describe("State", () => {
it("should contain the correct values", () => {
for (const key of Object.keys(
CrestronCH5.ReservedJoin.Serial.State,
)) {
const value = key.replace(/^Csig_/, "Csig.");

expect(
CrestronCH5.ReservedJoin.Serial.State[
key as keyof typeof SerialState
],
).toBe(value);
}
});
});
});
});

describe("SignalType", () => {
it("should contain the correct values", () => {
for (const key of Object.keys(CrestronCH5.SignalType)) {
const value = key.replace(/^Csig_/, "Csig.");

expect(
CrestronCH5.SignalType[key as keyof typeof SignalType],
).toBe(value);

Check failure on line 128 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > SignalType > should contain the correct values

AssertionError: expected 'boolean' to be 'Boolean' // Object.is equality - Expected + Received - Boolean + boolean ❯ tests/app.test.ts:128:19

Check failure on line 128 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 20.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > SignalType > should contain the correct values

AssertionError: expected 'boolean' to be 'Boolean' // Object.is equality - Expected + Received - Boolean + boolean ❯ tests/app.test.ts:128:19

Check failure on line 128 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 18.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > SignalType > should contain the correct values

AssertionError: expected 'boolean' to be 'Boolean' // Object.is equality - Expected + Received - Boolean + boolean ❯ tests/app.test.ts:128:19

Check failure on line 128 in tests/app.test.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 20.x and ubuntu-latest

tests/app.test.ts > Crestron CH5 Helper > SignalType > should contain the correct values

AssertionError: expected 'boolean' to be 'Boolean' // Object.is equality - Expected + Received - Boolean + boolean ❯ tests/app.test.ts:128:19
}
});
});

it("should always pass", () => {
expect(true).toBe(true);
});
});
23 changes: 0 additions & 23 deletions tests/reserved.test.ts

This file was deleted.

0 comments on commit af80848

Please sign in to comment.