From 51b221d063c6add8ddfc42ede2d01bd05885ab97 Mon Sep 17 00:00:00 2001 From: Pierre-Gilles Leymarie Date: Fri, 8 Nov 2024 17:04:32 +0100 Subject: [PATCH] Add missing test --- .../triggers/scene.trigger.alarmMode.test.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/server/test/lib/scene/triggers/scene.trigger.alarmMode.test.js b/server/test/lib/scene/triggers/scene.trigger.alarmMode.test.js index 283bdf61f7..e8db1371e4 100644 --- a/server/test/lib/scene/triggers/scene.trigger.alarmMode.test.js +++ b/server/test/lib/scene/triggers/scene.trigger.alarmMode.test.js @@ -215,6 +215,40 @@ describe('Scene.triggers.alarmMode', () => { }); }); }); + it('should execute scene with alarm.too-many-codes-tests trigger', async () => { + sceneManager.addScene({ + selector: 'my-scene', + active: true, + actions: [ + [ + { + type: ACTIONS.LIGHT.TURN_OFF, + devices: ['light-1'], + }, + ], + ], + triggers: [ + { + type: EVENTS.ALARM.TOO_MANY_CODES_TESTS, + house: 'house-1', + }, + ], + }); + sceneManager.checkTrigger({ + type: EVENTS.ALARM.TOO_MANY_CODES_TESTS, + house: 'house-1', + }); + return new Promise((resolve, reject) => { + sceneManager.queue.start(() => { + try { + assert.calledOnce(device.setValue); + resolve(); + } catch (e) { + reject(e); + } + }); + }); + }); it('should not execute scene (house not matching)', async () => { sceneManager.addScene({ selector: 'my-scene',