Skip to content

Commit 9764ee2

Browse files
authored
Tests/add animated mocks (#2456)
* Fix src/components/radioButton/__tests__/index.spec.tsx * Fix src/components/carousel/__tests__/index.spec.tsx
1 parent 8b11faa commit 9764ee2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

jest-setup.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {NativeModules, AccessibilityInfo} from 'react-native';
1+
import {NativeModules, AccessibilityInfo, Animated} from 'react-native';
22
global._UILIB_TESTING = true;
33

44
NativeModules.StatusBarManager = {getHeight: jest.fn()};
@@ -49,6 +49,17 @@ jest.mock('react-native', () => {
4949
return reactNative;
5050
});
5151

52+
Animated.timing = (value, config) => ({
53+
start: callback => {
54+
value.setValue(config.toValue);
55+
callback?.();
56+
}
57+
});
58+
Animated.parallel = () => ({
59+
start: () => {}
60+
});
61+
Animated.event = () => {};
62+
5263
if (typeof String.prototype.replaceAll === 'undefined') {
5364
// eslint-disable-next-line no-extend-native
5465
String.prototype.replaceAll = function (match, replace) {

0 commit comments

Comments
 (0)