From 81bf2767a1959c0ffe9f3a31ee54bb6f4648959e Mon Sep 17 00:00:00 2001 From: Martin Buchleitner Date: Fri, 8 Oct 2021 14:58:05 +0200 Subject: [PATCH] fix: test on node14 --- test/controller_spec.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/controller_spec.js b/test/controller_spec.js index fc3769f..e578466 100644 --- a/test/controller_spec.js +++ b/test/controller_spec.js @@ -4,7 +4,13 @@ const helper = require('node-red-node-test-helper'); const controllerNode = require('../alexa/alexa-home-controller.js'); const alexaNode = require('../alexa/alexa-home.js'); -const hubPort = 60000; + + +function between(min, max) { + return Math.floor( + Math.random() * (max - min) + min + ) +} function IsJsonString(str) { try { @@ -35,6 +41,7 @@ describe('alexa-home-controller Node', function () { }); it('should be loaded with correct default params', function (done) { + hubPort = between(50000, 60000); const flow = [{ id: 'n1', type: 'alexa-home-controller', controllername: 'Test', port: hubPort }]; helper.load(controllerNode, flow, function () { const n1 = helper.getNode('n1'); @@ -54,6 +61,7 @@ describe('alexa-home-controller Node', function () { }); }); it('should respond to setup request', function (done) { + hubPort = between(50000, 60000); const flow = [{ id: 'n1', type: 'alexa-home-controller', controllername: 'Test', port: hubPort }]; helper.load(controllerNode, flow, function () { const n1 = helper.getNode('n1'); @@ -70,6 +78,7 @@ describe('alexa-home-controller Node', function () { }); }); it('should respond to config request', function (done) { + hubPort = between(50000, 60000); const flow = [ { id: 'n1', type: 'alexa-home-controller', controllername: 'Test', port: hubPort }, ]; @@ -93,6 +102,7 @@ describe('alexa-home-controller Node', function () { }); }); it('should respond to lights request', function (done) { + hubPort = between(50000, 60000); const flow = [ { id: 'n1', type: 'alexa-home-controller', controllername: 'Test', port: hubPort }, ]; @@ -116,6 +126,7 @@ describe('alexa-home-controller Node', function () { }); }); it('should respond to registration request', function (done) { + hubPort = between(50000, 60000); const flow = [ { id: 'n1', type: 'alexa-home-controller', controllername: 'Test', port: hubPort }, ];