Skip to content

Commit

Permalink
tests: clarify orchestrator mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
tracernz committed Jan 17, 2025
1 parent 7fdf024 commit 0f7a443
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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({
Expand All @@ -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 = {
Expand Down

0 comments on commit 0f7a443

Please sign in to comment.