diff options
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]); |
