-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-client.js
72 lines (55 loc) · 1.75 KB
/
test-client.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* Created by roman on 07.12.14.
*/
var io = require('socket.io-client')
, assert = require('assert')
, expect = require('expect.js');
describe('Suite of unit tests', function() {
var socket,socket1;
beforeEach(function(done) {
// Setup
socket = io.connect('http://localhost:3000', {
'reconnection delay' : 0
, 'reopen delay' : 0
, 'force new connection' : true
});
socket.on('connect', function() {
console.log('s1 connected...');
});
socket.on('disconnect', function() {
console.log('disconnected...');
})
socket1 = io.connect('http://localhost:3000', {
'reconnection delay' : 0
, 'reopen delay' : 0
, 'force new connection' : true
});
socket1.on('connect', function() {
console.log('s1 connected...');
});
socket1.on('disconnect', function() {
console.log('s1 disconnected...');
})
});
afterEach(function(done) {
// Cleanup
if(socket.connected) {
console.log('disconnecting...');
socket.disconnect();
} else {
// There will not be a connection unless you have done() in beforeEach, socket.on('connect'...)
console.log('no connection to break...');
}
done();
});
describe('Test multiplayer workflow', function() {
it('Should work :)', function(done) {
socket.emit('user.info',{});
socket1.emit('user.info',{});
var when_got_init=function(client){
}
socket.on('game.init',function(){});
socket1.on('game.init',function(){});
});
});
});