From 0f7a4436bda3dc89cae9970ecfaaaf2f2520e59a Mon Sep 17 00:00:00 2001 From: Michael Corcoran Date: Sat, 18 Jan 2025 02:31:45 +1300 Subject: [PATCH] tests: clarify orchestrator mocks --- .../shared/src/failures/failures-orchestrator.spec.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fbw-common/src/systems/shared/src/failures/failures-orchestrator.spec.ts b/fbw-common/src/systems/shared/src/failures/failures-orchestrator.spec.ts index bad87bc0ea8..ff60b5ddf50 100644 --- a/fbw-common/src/systems/shared/src/failures/failures-orchestrator.spec.ts +++ b/fbw-common/src/systems/shared/src/failures/failures-orchestrator.spec.ts @@ -1,8 +1,8 @@ import { FailuresOrchestrator } from '.'; import { flushPromises } from './test-functions'; +// mock enough of JS GenericDataListener to ensure the right calls are made for JS interop const genericDataListenerSend = jest.fn(); - jest.mock('../GenericDataListenerSync', () => ({ GenericDataListenerSync: jest.fn().mockImplementation(() => { return { @@ -12,12 +12,7 @@ jest.mock('../GenericDataListenerSync', () => ({ })); let sendRequestForFailuresHandler = undefined; -const sendRequestForFailures = () => { - if (!sendRequestForFailuresHandler) { - throw new Error('View Listener never registered!'); - } - sendRequestForFailuresHandler(); -}; +const sendRequestForFailures = () => sendRequestForFailuresHandler(); global.RegisterViewListener = (name: string, callback?: any): ViewListener.ViewListener => { callback({ @@ -26,6 +21,7 @@ global.RegisterViewListener = (name: string, callback?: any): ViewListener.ViewL return undefined as any; }; +// mock enough of COMM BUS to ensure the right calls are made for WASM interop const failuresUpdateReceiver = jest.fn(); (global as any).RegisterGenericDataListener = jest.fn(); (global as any).Coherent = {