Skip to content

Commit

Permalink
Finish tests for connections model.
Browse files Browse the repository at this point in the history
  • Loading branch information
caedesvvv committed Oct 27, 2014
1 parent 6620700 commit 8159a50
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/unit/model/connectionsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,35 @@ define(['model/connections'], function(Connections) {
expect(connections.selectedServer).toBe(1);
});

it('sets the selected server', function() {
var sel = connections.getSelectedServer(1);
expect(sel).toEqual({ name : 'unsystem', type : 'gateway', address : 'wss://gateway.unsystem.net' });
});

it('cant remove the selected server', function() {
expect(connections.connections.servers.length).toBe(1);
connections.removeServer(connections.servers[0]);
expect(connections.connections.servers.length).toBe(1);
});

it('removes a server', function() {
connections.addServer('foo', 'bar', 'baz');
expect(connections.connections.servers.length).toBe(2);
connections.removeServer(connections.servers[1]);
expect(connections.connections.servers.length).toBe(1);
expect(connections.connections.selectedServer).toBe(0);
});

it('removes a server', function() {
connections.addServer('foo', 'bar', 'baz');
connections.setSelectedServer(1);
expect(connections.connections.servers.length).toBe(2);

connections.removeServer(connections.servers[0]);
expect(connections.connections.servers.length).toBe(1);
expect(connections.connections.selectedServer).toBe(0);
});

it('sets always connect setting', function() {
connections.setAlwaysConnect(1);
expect(connections.alwaysConnect).toBe(1);
Expand Down

0 comments on commit 8159a50

Please sign in to comment.