Skip to content

Commit 333eed7

Browse files
committed
Use __mocks__
1 parent 49d808b commit 333eed7

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// __mocks__/react-native-reanimated/index.js
2+
const actualAnimated = jest.requireActual('react-native-reanimated/mock');
3+
4+
const mock = {
5+
...actualAnimated,
6+
createAnimatedPropAdapter: jest.fn(),
7+
useReducedMotion: jest.fn(),
8+
};
9+
10+
export default mock;

tests/ui/GroupChatNameTests.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import * as TestHelper from '../utils/TestHelper';
1515
import {navigateToSidebarOption} from '../utils/TestHelper';
1616
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';
1717
import waitForBatchedUpdatesWithAct from '../utils/waitForBatchedUpdatesWithAct';
18-
import Animated from "react-native-reanimated";
1918

2019
// We need a large timeout here as we are lazy loading React Navigation screens and this test is running against the entire mounted App
2120
jest.setTimeout(50000);
@@ -32,12 +31,6 @@ jest.mock('react-native/Libraries/LogBox/LogBox', () => ({
3231
},
3332
}));
3433

35-
jest.mock('react-native-reanimated', () => ({
36-
...jest.requireActual<typeof Animated>('react-native-reanimated/mock'),
37-
createAnimatedPropAdapter: jest.fn,
38-
useReducedMotion: jest.fn,
39-
}));
40-
4134
/**
4235
* We need to keep track of the transitionEnd callback so we can trigger it in our tests
4336
*/

tests/ui/UnreadIndicatorsTest.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ jest.mock('react-native/Libraries/LogBox/LogBox', () => ({
4444
},
4545
}));
4646

47-
jest.mock('react-native-reanimated', () => ({
48-
...jest.requireActual<typeof Animated>('react-native-reanimated/mock'),
49-
createAnimatedPropAdapter: jest.fn,
50-
useReducedMotion: jest.fn,
51-
}));
52-
5347
/**
5448
* We need to keep track of the transitionEnd callback so we can trigger it in our tests
5549
*/

0 commit comments

Comments
 (0)