Skip to content

Commit

Permalink
fix: move InteractionManager mock to dedicated file
Browse files Browse the repository at this point in the history
  • Loading branch information
WoLewicki committed Apr 26, 2023
1 parent 2807556 commit 8be6a05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 4 additions & 0 deletions __mocks__/react-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ jest.doMock('react-native', () => {
dimensions = newDimensions;
},
},
InteractionManager: {
...ReactNative.InteractionManager,
runAfterInteractions: callback => callback(),
},
},
ReactNative,
);
Expand Down
8 changes: 0 additions & 8 deletions tests/ui/UnreadIndicatorsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ jest.setTimeout(30000);

jest.mock('../../src/libs/Notification/LocalNotification');

// we need to mock it for the ReportScreen to update its state immediately for tests to pass
jest.mock('react-native/libraries/Interaction/InteractionManager', () => {
const IM = jest.requireActual('react-native/libraries/Interaction/InteractionManager');
IM.runAfterInteractions = jest.fn(fn => fn());

return IM;
});

beforeAll(() => {
// In this test, we are generically mocking the responses of all API requests by mocking fetch() and having it
// return 200. In other tests, we might mock HttpUtils.xhr() with a more specific mock data response (which means
Expand Down

0 comments on commit 8be6a05

Please sign in to comment.