diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-07-07 09:54:54 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-07-07 09:54:54 +0200 |
| commit | 35f2a91585f4c94de2e4668eab99890fa50c22a9 (patch) | |
| tree | e89ffb2c783fb047ece5163ab80d78f419906ded /test/connect.spec.js | |
| parent | db78c15f3445899bc0760bfea5194ae1d7896f47 (diff) | |
| parent | 518c934c98395f165977fd28837f4817cee664e7 (diff) | |
| download | mullvadvpn-35f2a91585f4c94de2e4668eab99890fa50c22a9.tar.xz mullvadvpn-35f2a91585f4c94de2e4668eab99890fa50c22a9.zip | |
Merge branch 'up-down-events'
Diffstat (limited to 'test/connect.spec.js')
| -rw-r--r-- | test/connect.spec.js | 34 |
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'); + + }); }); |
