Skip to content
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 lib/Endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Endpoint extends EventEmitter {
*/
unbind(clusterName) {
const OutputCluster = Cluster.getCluster(clusterName);
this.bindings[OutputCluster.NAME] = new OutputCluster(this, OutputCluster);
delete this.bindings[OutputCluster.NAME];
}

/**
Expand Down
26 changes: 11 additions & 15 deletions test/virtualDevice.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,18 @@ describe('Virtual device: known bugs on master', function () {
);
});

it(
'Endpoint.unbind removes the binding, so the cluster is unsupported',
{ todo: 'unbind leaves a Cluster in bindings' },
async function () {
const { zclNode, virtualDevice } = createVirtualDevice({
endpoints: [{ endpointId: 1, outputClusters: [OnOffCluster.ID] }],
});
zclNode.endpoints[1].bind('onOff', new BoundCluster());
zclNode.endpoints[1].unbind('onOff');
it('Endpoint.unbind removes the binding, so the cluster is unsupported', async function () {
const { zclNode, virtualDevice } = createVirtualDevice({
endpoints: [{ endpointId: 1, outputClusters: [OnOffCluster.ID] }],
});
zclNode.endpoints[1].bind('onOff', new BoundCluster());
zclNode.endpoints[1].unbind('onOff');

await assert.rejects(
virtualDevice.endpoints[1].clusters.onOff.toggle(),
/^Error: UNSUPPORTED_CLUSTER$/,
);
},
);
await assert.rejects(
virtualDevice.endpoints[1].clusters.onOff.toggle(),
/^Error: UNSUPPORTED_CLUSTER$/,
);
});

it(
'a report with an unknown attribute id does not emit attr.undefined',
Expand Down
Loading