diff options
Diffstat (limited to 'test/mocks')
| -rw-r--r-- | test/mocks/ipc.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/mocks/ipc.js b/test/mocks/ipc.js index 8f0b82ba37..2672a431fd 100644 --- a/test/mocks/ipc.js +++ b/test/mocks/ipc.js @@ -1,20 +1,23 @@ // @flow -import type { IpcFacade, BackendState, IpcCredentials } from '../../app/lib/ipc-facade'; +import type { IpcFacade, BackendState } from '../../app/lib/ipc-facade'; interface MockIpc { sendNewState: (BackendState) => void; + killWebSocket: () => void; -getAccountData: *; -connect: *; -getAccount: *; + -auth: *; } export function newMockIpc() { const stateListeners = []; + const connectionCloseListeners = []; const mockIpc: IpcFacade & MockIpc = { - setCredentials: (_credentials: IpcCredentials) => {}, + setConnectionString: (_str: string) => {}, getAccountData: (accountToken) => { return new Promise(r => r({ accountToken: accountToken, @@ -60,6 +63,15 @@ export function newMockIpc() { l(state); } }, + auth: (_secret: string) => Promise.resolve(), + setCloseConnectionHandler: (listener: () => void) => { + connectionCloseListeners.push(listener); + }, + killWebSocket: () => { + for(const l of connectionCloseListeners) { + l(); + } + } }; return mockIpc; |
