Skip to content

Commit

Permalink
Add test for onScenesChanged
Browse files Browse the repository at this point in the history
  • Loading branch information
mundschenk-at committed Nov 24, 2023
1 parent 09c20f9 commit 65f4795
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion test/homeassistant.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2118,4 +2118,24 @@ describe('HomeAssistant extension', () => {
expect.any(Function),
);
});
});

it('Should rediscover scenes when a scene is changed', async () => {
const device = controller.zigbee.resolveEntity(zigbeeHerdsman.devices.bulb_color_2);
MQTT.publish.mockClear();
controller.eventBus.emitScenesChanged();
await flushPromises();
expect(MQTT.publish).toHaveBeenCalledWith(
`homeassistant/scene/${device.ID}/scene_1/config`,
null,
{retain: true, qos: 1},
expect.any(Function),
);

expect(MQTT.publish).toHaveBeenCalledWith(
`homeassistant/scene/${device.ID}/scene_1/config`,
expect.any(Object),
{retain: true, qos: 1},
expect.any(Function),
);
});
});

0 comments on commit 65f4795

Please sign in to comment.