Skip to content

Commit ce58915

Browse files
committed
updating test to make sure the event is fired
1 parent 4bb8ae3 commit ce58915

File tree

1 file changed

+15
-26
lines changed

1 file changed

+15
-26
lines changed

test/mqtt-connection-events.html

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,61 +43,50 @@
4343
});
4444

4545
// Setp 3: Test the element
46-
test('calling _handelConnected should fire a `mqtt-connection-connected` event', function () {
46+
test('calling _handelConnected should fire a `mqtt-connection-connected` event', function (done) {
4747
mqttElement.addEventListener('mqtt-connection-connected', function () {
48-
// TODO signal the testrunner that the test succeeded
49-
console.log("mqtt-connection-connected")
48+
done();
5049
});
5150
mqttElement._handelConnected();
52-
// TODO Make sure event is fired
5351
});
5452

55-
test('calling _handelReconnect should fire a `mqtt-connection-reconnect` event', function () {
53+
test('calling _handelReconnect should fire a `mqtt-connection-reconnect` event', function (done) {
5654
mqttElement.addEventListener('mqtt-connection-reconnect', function () {
57-
// TODO signal the testrunner that the test succeeded
58-
console.log("mqtt-connection-reconnect")
55+
done();
5956
});
6057
mqttElement._handelReconnect();
61-
// TODO Make sure event is fired
6258
});
6359

64-
test('calling _handelClose should fire a `mqtt-connection-close` event', function () {
60+
test('calling _handelClose should fire a `mqtt-connection-close` event', function (done) {
6561
mqttElement.addEventListener('mqtt-connection-close', function () {
66-
// TODO signal the testrunner that the test succeeded
67-
console.log("mqtt-connection-close")
62+
done();
6863
});
6964
mqttElement._handelClose();
70-
// TODO Make sure event is fired
7165
});
7266

73-
test('calling _handelOffline should fire a `mqtt-connection-offline` event', function () {
67+
test('calling _handelOffline should fire a `mqtt-connection-offline` event', function (done) {
7468
mqttElement.addEventListener('mqtt-connection-offline', function () {
75-
// TODO signal the testrunner that the test succeeded
76-
console.log("mqtt-connection-offline")
69+
done();
7770
});
7871
mqttElement._handelOffline();
79-
// TODO Make sure event is fired
8072
});
8173

82-
test('calling _handelError should fire a `mqtt-connection-reconnect` event', function () {
83-
mqttElement.addEventListener('mqtt-connection-reconnect', function () {
84-
// TODO signal the testrunner that the test succeeded
85-
console.log("mqtt-connection-reconnect")
74+
test('calling _handelError should fire a `mqtt-connection-error` event', function (done) {
75+
mqttElement.addEventListener('mqtt-connection-error', function () {
76+
done();
8677
});
8778
mqttElement._handelError();
88-
// TODO Make sure event is fired
8979
});
9080

91-
test('calling _handelMessage should fire a `mqtt-message` event', function () {
81+
test('calling _handelMessage should fire a `mqtt-message` event', function (done) {
9282
mqttElement.addEventListener('mqtt-message', function () {
93-
// TODO signal the testrunner that the test succeeded
94-
console.log("mqtt-message")
83+
console.log("mqtt-message", arguments);
84+
done();
9585
});
96-
// TODO generate a test message and packet
86+
// Generating a test message/ packet
9787
var message = {};
9888
var packet = {};
9989
mqttElement._handelMessage("mqttjs/test/message", message, packet);
100-
// TODO Make sure event is fired
10190
});
10291

10392
});

0 commit comments

Comments
 (0)