describe('TasmotaHandler - connect', () => { const tasmotaHandler = new TasmotaHandler(gladys, 'service-uuid-random'); sinon.spy(tasmotaHandler, 'handleMqttMessage'); beforeEach(() => { sinon.reset(); }); it('connect with subscription', () => { tasmotaHandler.connect(); assert.calledWith(gladys.service.getService, 'mqtt'); assert.callCount(mqttService.device.subscribe, 2); mqttService.device.subscribe.firstCall.calledWith( 'stat/+/+', tasmotaHandler.handleMqttMessage.bind(tasmotaHandler), ); mqttService.device.subscribe.secondCall.calledWith( 'tele/+/+', tasmotaHandler.handleMqttMessage.bind(tasmotaHandler), ); }); });
const [stream2, config2, key2] = s3Spy.secondCall.args expect(stream2).to.be.ok expect(config2.S3_BUCKET).to.equal(mockEvent.S3_BUCKET)
validateSpy.should.have.been.calledBefore(runHooksSpy.secondCall); runHooksSpy.secondCall.should.have.been.calledWith(ODM.Hook.types.afterValidate); runHooksSpy.should.have.been.calledTwice; runHooksSpy.restore();