Skip to content

Commit

Permalink
Update to Mosca V2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-doyle committed Mar 14, 2018
1 parent dd84027 commit 1dc233a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.2.4",
"description": "MQTT Broker server on Node-RED",
"dependencies": {
"mosca": "^2.7.0"
"mosca": "^2.8.0"
},
"license": "MIT",
"repository": {
Expand All @@ -16,7 +16,7 @@
"mqtt"
],
"scripts": {
"test": "mocha test/**/*_spec.js"
"test": "npm link node-red & mocha test/**/*_spec.js"
},
"node-red": {
"nodes": {
Expand Down
15 changes: 5 additions & 10 deletions test/mosca_spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
var should = require('should');
var helper = require('node-red-node-test-helper');
var moscaNode = require('../mosca.js');
var mqttNode = require('../node_modules/node-red/nodes/core/io/10-mqtt.js');
var injectNode = require('../node_modules/node-red/nodes/core/core/20-inject.js');


describe('MQTT Broker Node', function () {
Expand Down Expand Up @@ -36,7 +34,7 @@ describe('MQTT Broker Node', function () {
var timestamp = new Date();
timestamp.setSeconds(timestamp.getSeconds() + 1);

helper.load([injectNode, moscaNode, mqttNode], [{
helper.load([moscaNode, mqttNode], [{
id: 'n1',
type: 'mosca in',
mqtt_port: '1883',
Expand Down Expand Up @@ -64,7 +62,6 @@ describe('MQTT Broker Node', function () {
}
],
function () {
var n1 = helper.getNode('n1');
var n2 = helper.getNode('n2');
n2.on('input', function (msg) {
msg.should.have.property('topic', 'clientConnected');
Expand All @@ -78,7 +75,7 @@ describe('MQTT Broker Node', function () {
var timestamp = new Date();
timestamp.setSeconds(timestamp.getSeconds() + 1);

helper.load([injectNode, moscaNode, mqttNode], [{
helper.load([moscaNode, mqttNode], [{
id: 'n1',
type: 'mosca in',
mqtt_port: '1883',
Expand Down Expand Up @@ -127,25 +124,23 @@ describe('MQTT Broker Node', function () {
name: 'Broker',
broker: 'localhost',
port: '1884'
},
}
],
function () {
var i = 0;
var n1 = helper.getNode('n1');
var n2 = helper.getNode('n2');
n2.on('input', function (msg) {
msg.should.have.property('topic', 'clientConnected');
i++;
if (i == 2) {
if (i === 2) {
done();
}
});
var n11 = helper.getNode('n11');
var n12 = helper.getNode('n12');
n12.on('input', function (msg) {
msg.should.have.property('topic', 'clientConnected');
i++;
if (i == 2) {
if (i === 2) {
done();
}
});
Expand Down

0 comments on commit 1dc233a

Please sign in to comment.