summaryrefslogtreecommitdiffhomepage
path: root/test/connect.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/connect.spec.js')
-rw-r--r--test/connect.spec.js34
1 files changed, 21 insertions, 13 deletions
diff --git a/test/connect.spec.js b/test/connect.spec.js
index 20b182107a..56fdb76afc 100644
--- a/test/connect.spec.js
+++ b/test/connect.spec.js
@@ -23,19 +23,6 @@ describe('connect', () => {
store.dispatch(connectionActions.connect(backend, 'example.com'));
});
- it('should update the state with the connection info once connection is established', (done) => {
- const { store, backend } = setupBackendAndStore();
-
- store.dispatch(connectionActions.connect(backend, 'example.com'));
-
- checkNextTick( () => {
- const state = store.getState().connection;
-
- expect(state.status).to.equal('connected');
- expect(state.serverAddress).to.equal('example.com');
- }, done);
- });
-
it('should set the connection state to \'disconnected\' on failed attempts', (done) => {
const { store, mockIpc, backend } = setupBackendAndStore();
@@ -55,5 +42,26 @@ describe('connect', () => {
expect(store.getState().connection.status).to.equal('disconnected');
}, done);
});
+
+ it('should update the store on \'secured\' state from the backend', () => {
+ const { store, mockIpc } = setupBackendAndStore();
+
+ expect(store.getState().connection.status).not.to.equal('connected');
+ mockIpc.sendNewState('secured');
+ expect(store.getState().connection.status).to.equal('connected');
+
+ });
+
+ it('should update the store on \'unsecured\' state from the backend', () => {
+ const { store, mockIpc } = setupBackendAndStore();
+ store.dispatch(connectionActions.connectionChange({
+ status: 'connected',
+ }));
+
+ expect(store.getState().connection.status).not.to.equal('disconnected');
+ mockIpc.sendNewState('unsecured');
+ expect(store.getState().connection.status).to.equal('disconnected');
+
+ });
});