Skip to content

Commit

Permalink
fix: test on node14
Browse files Browse the repository at this point in the history
  • Loading branch information
mabunixda committed Oct 8, 2021
1 parent e7a1a8e commit 81bf276
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/controller_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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 },
];
Expand All @@ -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 },
];
Expand All @@ -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 },
];
Expand Down

0 comments on commit 81bf276

Please sign in to comment.