Example #1
0
  it('Set state same state', function(done) {
    var server = new Server(new Remote(), 'wss://localhost:5006');

    server._state = 'online';

    server.once('state', function(state) {
      assert(!server._connected);
      assert.strictEqual(state, 'offline');
      done();
    });

    server._setState('online');
    server._setState('offline');
  });
Example #2
0
  it('Set state offline', function(done) {
    var server = new Server(new Remote(), 'wss://localhost:5006');

    server._state = 'online';

    server.once('disconnect', function() {
      assert(!server._connected);
      done();
    });

    server._setState('offline');
  });