[go: up one dir, main page]

Skip to content

Commit

Permalink
try to fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
sjorge committed Jun 22, 2024
1 parent 98e5538 commit c846fba
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/otaUpdate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,24 @@ describe('OTA update', () => {
);
});

it('Should be read develcoPrimarySwVersion for Develco devices', async () => {
const device = zigbeeHerdsman.devices.bulb;
device.manufacturerID = 4117;
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
mockClear(mapped);

mapped.ota.isUpdateAvailable.mockReturnValueOnce({available: false, currentFileVersion: 10, otaFileVersion: 10});
MQTT.events.message('zigbee2mqtt/bridge/request/device/ota_update/check', "bulb");
await flushPromises();
expect(mapped.ota.isUpdateAvailable).toHaveBeenCalledTimes(1);
expect(mapped.ota.updateToLatest).toHaveBeenCalledTimes(0);
expect(MQTT.publish).toHaveBeenCalledWith(
'zigbee2mqtt/bridge/response/device/ota_update/check',
stringify({"data":{"id": "bulb","updateAvailable":false},"status":"ok"}),
{retain: false, qos: 0}, expect.any(Function)
);
});

it('Should be able to check if OTA update is available', async () => {
const device = zigbeeHerdsman.devices.bulb;
const mapped = await zigbeeHerdsmanConverters.findByDevice(device)
Expand Down

0 comments on commit c846fba

Please sign in to comment.