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/mocks | |
| parent | 5852c980980de53e00d76a0bdb4b41bf5c0f5b39 (diff) | |
| download | mullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.tar.xz mullvadvpn-ca2f6fbfcad7b73d4ea63ef46cb1cab943ec9087.zip | |
Add formatted source code
Diffstat (limited to 'test/mocks')
| -rw-r--r-- | test/mocks/ipc.js | 73 | ||||
| -rw-r--r-- | test/mocks/redux.js | 2 |
2 files changed, 39 insertions, 36 deletions
diff --git a/test/mocks/ipc.js b/test/mocks/ipc.js index 900e149c33..cd8dc9fbac 100644 --- a/test/mocks/ipc.js +++ b/test/mocks/ipc.js @@ -11,22 +11,22 @@ interface MockIpc { } export function newMockIpc() { - const stateListeners = []; const connectionCloseListeners = []; const mockIpc: IpcFacade & MockIpc = { - setConnectionString: (_str: string) => {}, - getAccountData: (accountToken) => Promise.resolve({ - accountToken: accountToken, - expiry: '', - }), + getAccountData: (accountToken) => + Promise.resolve({ + accountToken: accountToken, + expiry: '', + }), - getRelayLocations: () => Promise.resolve({ - countries: [], - }), + getRelayLocations: () => + Promise.resolve({ + countries: [], + }), getAccount: () => Promise.resolve('1111'), @@ -34,17 +34,18 @@ export function newMockIpc() { updateRelaySettings: () => Promise.resolve(), - getRelaySettings: () => Promise.resolve({ - custom_tunnel_endpoint: { - host: 'www.example.com', - tunnel: { - openvpn: { - port: 1301, - protocol: 'udp', - } - } - }, - }), + getRelaySettings: () => + Promise.resolve({ + custom_tunnel_endpoint: { + host: 'www.example.com', + tunnel: { + openvpn: { + port: 1301, + protocol: 'udp', + }, + }, + }, + }), setAllowLan: (_allowLan: boolean) => Promise.resolve(), @@ -56,26 +57,28 @@ export function newMockIpc() { shutdown: () => Promise.resolve(), - getLocation: () => Promise.resolve({ - ip: '', - country: '', - city: '', - latitude: 0.0, - longitude: 0.0, - mullvad_exit_ip: false, - }), + getLocation: () => + Promise.resolve({ + ip: '', + country: '', + city: '', + latitude: 0.0, + longitude: 0.0, + mullvad_exit_ip: false, + }), - getState: () => Promise.resolve({ - state: 'unsecured', - target_state:'unsecured', - }), + getState: () => + Promise.resolve({ + state: 'unsecured', + target_state: 'unsecured', + }), registerStateListener: (listener: (BackendState) => void) => { stateListeners.push(listener); }, sendNewState: (state: BackendState) => { - for(const l of stateListeners) { + for (const l of stateListeners) { l(state); } }, @@ -91,10 +94,10 @@ export function newMockIpc() { removeAccountFromHistory: (_accountToken) => Promise.resolve(), killWebSocket: () => { - for(const l of connectionCloseListeners) { + for (const l of connectionCloseListeners) { l(); } - } + }, }; return mockIpc; diff --git a/test/mocks/redux.js b/test/mocks/redux.js index a652009645..bbab7b17f4 100644 --- a/test/mocks/redux.js +++ b/test/mocks/redux.js @@ -1,4 +1,4 @@ import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; -export const mockStore = configureMockStore([ thunk ]); +export const mockStore = configureMockStore([thunk]); |
