diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-06-01 16:13:10 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-06-05 12:11:55 +0200 |
| commit | ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087 (patch) | |
| tree | b1f7754eb50896ab3681e35fa4e08be642b940c9 /test/connect.spec.js | |
| parent | 5852c980980de53e00d76a0bdb4b41bf5c0f5b39 (diff) | |
| download | mullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.tar.xz mullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.zip | |
Add formatted source code
Diffstat (limited to 'test/connect.spec.js')
| -rw-r--r-- | test/connect.spec.js | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/test/connect.spec.js b/test/connect.spec.js index 056e1bfe15..0b5b33be53 100644 --- a/test/connect.spec.js +++ b/test/connect.spec.js @@ -5,20 +5,17 @@ import connectionActions from '../app/redux/connection/actions'; import { setupBackendAndStore, checkNextTick } from './helpers/ipc-helpers'; describe('connect', () => { - - it('should set the connection state to \'disconnected\' on failed attempts', (done) => { + it("should set the connection state to 'disconnected' on failed attempts", (done) => { const { store, mockIpc, backend } = setupBackendAndStore(); mockIpc.connect = () => new Promise((_, reject) => reject('Some error')); store.dispatch(connectionActions.connected()); - expect(store.getState().connection.status).not.to.equal('disconnected'); store.dispatch(connectionActions.connect(backend)); - checkNextTick(() => { expect(store.getState().connection.status).to.equal('disconnected'); }, done); @@ -27,41 +24,40 @@ describe('connect', () => { it('should update the state with the server address', () => { const { store, backend } = setupBackendAndStore(); - return backend.connect() - .then( () => { - const state = store.getState().connection; - expect(state.status).to.equal('connecting'); - }); + return backend.connect().then(() => { + const state = store.getState().connection; + expect(state.status).to.equal('connecting'); + }); }); - it('should correctly deduce \'connected\' from backend states', (done) => { + it("should correctly deduce 'connected' from backend states", (done) => { const { store, mockIpc } = setupBackendAndStore(); - checkNextTick( () => { + checkNextTick(() => { expect(store.getState().connection.status).not.to.equal('connected'); mockIpc.sendNewState({ state: 'secured', target_state: 'secured' }); expect(store.getState().connection.status).to.equal('connected'); }, done); }); - it('should correctly deduce \'connecting\' from backend states', (done) => { + it("should correctly deduce 'connecting' from backend states", (done) => { const { store, mockIpc } = setupBackendAndStore(); - checkNextTick( () => { + checkNextTick(() => { expect(store.getState().connection.status).not.to.equal('connecting'); mockIpc.sendNewState({ state: 'unsecured', target_state: 'secured' }); expect(store.getState().connection.status).to.equal('connecting'); }, done); }); - it('should correctly deduce \'disconnected\' from backend states', (done) => { + it("should correctly deduce 'disconnected' from backend states", (done) => { const { store, mockIpc } = setupBackendAndStore(); store.dispatch(connectionActions.connected()); - checkNextTick( () => { + checkNextTick(() => { expect(store.getState().connection.status).not.to.equal('disconnected'); mockIpc.sendNewState({ state: 'unsecured', target_state: 'unsecured' }); expect(store.getState().connection.status).to.equal('disconnected'); }, done); }); -});
\ No newline at end of file +}); |
