-
-
Notifications
You must be signed in to change notification settings - Fork 634
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: expose values for some controlled CCs (#1849)
- Loading branch information
Showing
2 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
packages/zwave-js/src/lib/test/cc/sceneActivationValueID.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { CommandClasses } from "@zwave-js/core"; | ||
import type { ThrowingMap } from "../../controller/Controller"; | ||
import type { Driver } from "../../driver/Driver"; | ||
import { ZWaveNode } from "../../node/Node"; | ||
import { createAndStartDriver } from "../utils"; | ||
|
||
describe("regression tests", () => { | ||
let driver: Driver; | ||
|
||
beforeEach(async () => { | ||
({ driver } = await createAndStartDriver()); | ||
|
||
driver["_controller"] = { | ||
ownNodeId: 1, | ||
isFunctionSupported: () => true, | ||
nodes: new Map(), | ||
} as any; | ||
}); | ||
|
||
afterEach(async () => { | ||
await driver.destroy(); | ||
driver.removeAllListeners(); | ||
}); | ||
|
||
it("a node that controls the Scene Activation CC should include the scene ID in getDefinedValueIDs()", async () => { | ||
const node2 = new ZWaveNode(2, driver); | ||
node2.addCC(CommandClasses["Scene Activation"], { | ||
isControlled: true, | ||
}); | ||
(driver.controller.nodes as ThrowingMap<number, ZWaveNode>).set( | ||
2, | ||
node2, | ||
); | ||
|
||
const valueIDs = node2.getDefinedValueIDs(); | ||
expect(valueIDs.some((v) => v.property === "sceneId")).toBeTrue(); | ||
}); | ||
}); |