forked from simplewebrtc/signalmaster
-
Notifications
You must be signed in to change notification settings - Fork 7
/
test.js
37 lines (30 loc) · 885 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var tape = require('tape');
var config = require('getconfig');
var server = require('./server');
var test = tape.createHarness();
var output = test.createStream();
output.pipe(process.stdout);
output.on('end', function () {
console.log('Tests complete, killing server.');
process.exit(0);
});
var io = require('socket.io-client');
var socketURL;
if (config.server.secure) {
socketURL = "https://localhost:" + config.server.port;
} else {
socketURL = "http://localhost:" + config.server.port;
}
var socketOptions = {
transports: ['websocket'],
'force new connection': true,
"secure": config.server.secure
};
test('it should not crash when sent an empty message', function (t) {
t.plan(1);
var client = io.connect(socketURL, socketOptions);
client.on('connect', function () {
client.emit('message');
t.ok(true);
});
});