UNPKG

798 BJavaScriptView Raw
1var PeerClient = require('../lib/peer_client');
2var assert = require('assert');
3
4
5var MockServer = { _name: '1234', httpServer: { spdyServer: {}}, log: {}};
6var urlEndingWithSlash = 'http://cloud.zettajs.io/';
7var urlEndingWithNoSlash = 'http://cloud.zettajs.io';
8
9describe('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});