|
43 | 43 | }); |
44 | 44 |
|
45 | 45 | // 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) { |
47 | 47 | mqttElement.addEventListener('mqtt-connection-connected', function () { |
48 | | - // TODO signal the testrunner that the test succeeded |
49 | | - console.log("mqtt-connection-connected") |
| 48 | + done(); |
50 | 49 | }); |
51 | 50 | mqttElement._handelConnected(); |
52 | | - // TODO Make sure event is fired |
53 | 51 | }); |
54 | 52 |
|
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) { |
56 | 54 | mqttElement.addEventListener('mqtt-connection-reconnect', function () { |
57 | | - // TODO signal the testrunner that the test succeeded |
58 | | - console.log("mqtt-connection-reconnect") |
| 55 | + done(); |
59 | 56 | }); |
60 | 57 | mqttElement._handelReconnect(); |
61 | | - // TODO Make sure event is fired |
62 | 58 | }); |
63 | 59 |
|
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) { |
65 | 61 | mqttElement.addEventListener('mqtt-connection-close', function () { |
66 | | - // TODO signal the testrunner that the test succeeded |
67 | | - console.log("mqtt-connection-close") |
| 62 | + done(); |
68 | 63 | }); |
69 | 64 | mqttElement._handelClose(); |
70 | | - // TODO Make sure event is fired |
71 | 65 | }); |
72 | 66 |
|
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) { |
74 | 68 | mqttElement.addEventListener('mqtt-connection-offline', function () { |
75 | | - // TODO signal the testrunner that the test succeeded |
76 | | - console.log("mqtt-connection-offline") |
| 69 | + done(); |
77 | 70 | }); |
78 | 71 | mqttElement._handelOffline(); |
79 | | - // TODO Make sure event is fired |
80 | 72 | }); |
81 | 73 |
|
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(); |
86 | 77 | }); |
87 | 78 | mqttElement._handelError(); |
88 | | - // TODO Make sure event is fired |
89 | 79 | }); |
90 | 80 |
|
91 | | - test('calling _handelMessage should fire a `mqtt-message` event', function () { |
| 81 | + test('calling _handelMessage should fire a `mqtt-message` event', function (done) { |
92 | 82 | 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(); |
95 | 85 | }); |
96 | | - // TODO generate a test message and packet |
| 86 | + // Generating a test message/ packet |
97 | 87 | var message = {}; |
98 | 88 | var packet = {}; |
99 | 89 | mqttElement._handelMessage("mqttjs/test/message", message, packet); |
100 | | - // TODO Make sure event is fired |
101 | 90 | }); |
102 | 91 |
|
103 | 92 | }); |
|
0 commit comments