1 | var PeerClient = require('../lib/peer_client');
|
2 | var assert = require('assert');
|
3 |
|
4 |
|
5 | var MockServer = { _name: '1234', httpServer: { spdyServer: {}}, log: {}};
|
6 | var urlEndingWithSlash = 'http://cloud.zettajs.io/';
|
7 | var urlEndingWithNoSlash = 'http://cloud.zettajs.io';
|
8 |
|
9 | describe('Peer Client', function() {
|
10 | describe('url parsing', function() {
|
11 | it('should calculate the proper url with a trailing slash', function() {
|
12 | var client = new PeerClient(urlEndingWithSlash, MockServer);
|
13 | assert.equal(client.url, 'ws://cloud.zettajs.io/peers/1234');
|
14 | });
|
15 |
|
16 | it('should calculate the proper url without a trailing slash', function() {
|
17 | var client = new PeerClient(urlEndingWithNoSlash, MockServer);
|
18 | assert.equal(client.url, 'ws://cloud.zettajs.io/peers/1234');
|
19 | });
|
20 | });
|
21 | });
|