mirror of
https://gitlab.silvrtree.co.uk/martind2000/SODashServer.git
synced 2025-01-11 04:35:10 +00:00
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
"use strict";
|
|
var should = require('should'), mqtt = require('mqtt'), mqttConnect = require('../lib/mqtt/mqttConnect');
|
|
|
|
describe('MQTT - Projector', function () {
|
|
beforeEach(function () {
|
|
mqttConnect.doConnection();
|
|
});
|
|
|
|
it('should create client', function (done) {
|
|
mqttConnect.client.should.be.instanceOf(mqtt.MqttClient);
|
|
done();
|
|
});
|
|
|
|
it('should connect to IBM', function (done) {
|
|
mqttConnect.client.on('connect', function () {
|
|
done();
|
|
})
|
|
.on('error', function (err) {
|
|
done(err);
|
|
});
|
|
});
|
|
|
|
it('should turn the projector ON', function (done) {
|
|
mqttConnect.client.on('connect', function () {
|
|
mqttConnect.projectorOn(function (err) {
|
|
should.not.exist(err);
|
|
});
|
|
done();
|
|
})
|
|
.on('error', function (err) {
|
|
done(err);
|
|
});
|
|
|
|
});
|
|
|
|
it('should turn the projector OFF', function (done) {
|
|
mqttConnect.client.on('connect', function () {
|
|
mqttConnect.projectorOff(function (err) {
|
|
should.not.exist(err);
|
|
});
|
|
done();
|
|
})
|
|
.on('error', function (err) {
|
|
done(err);
|
|
});
|
|
|
|
});
|
|
|
|
}); |