Skip to content

Commit

Permalink
test: include all 3 possible cases
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone committed Oct 31, 2023
1 parent 56e70b0 commit bfd360b
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions packages/zwave-js/src/lib/test/compat/treatBasicSetAsEvent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,65 @@ integrationTest(
isControlled: true,
version: 1,
},
],
},

additionalDriverOptions: {
storage: {
deviceConfigPriorityDir: path.join(
__dirname,
"fixtures/basicEventNoSupport",
),
},
},

async testBody(t, driver, node, mockController, mockNode) {
// Make sure the custom config is loaded
const treatBasicSetAsEvent = node.deviceConfig?.compat
?.treatBasicSetAsEvent;
t.is(treatBasicSetAsEvent, true);

const valueIDs = node.getDefinedValueIDs();
t.false(
valueIDs.some((v) => BasicCCValues.currentValue.is(v)),
"Found Basic CC currentValue although it shouldn't be exposed",
);
t.false(
valueIDs.some((v) => BasicCCValues.targetValue.is(v)),
"Found Basic CC targetValue although it shouldn't be exposed",
);
t.false(
valueIDs.some((v) => BasicCCValues.duration.is(v)),
"Found Basic CC duration although it shouldn't be exposed",
);
t.false(
valueIDs.some((v) => BasicCCValues.restorePrevious.is(v)),
"Found Basic CC restorePrevious although it shouldn't be exposed",
);

t.true(
valueIDs.some((v) => BasicCCValues.compatEvent.is(v)),
"Did not find Basic CC compatEvent although it should be exposed",
);
},
},
);

integrationTest(
"Basic CC values should only include the compatEvent value if Basic CC should be hidden in favor of another CC, but the compat flag is set",
{
// debug: true,

nodeCapabilities: {
manufacturerId: 0xdead,
productType: 0xbeef,
productId: 0xcafe,

commandClasses: [
CommandClasses.Version,
CommandClasses["Manufacturer Specific"],
// Basic CC is supported, but should be hidden
CommandClasses.Basic,
CommandClasses["Binary Switch"],
],
},
Expand Down

0 comments on commit bfd360b

Please sign in to comment.