generated from ApollosProject/apollos-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.setup.js
44 lines (36 loc) · 1.04 KB
/
jest.setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { Animated } from 'react-native';
import ApollosConfig from '@apollosproject/config';
import FRAGMENTS from '@apollosproject/ui-fragments';
ApollosConfig.loadJs({
FRAGMENTS,
ONE_SIGNAL_KEY: 'doesntmatter',
});
Animated.timing = (value, config) => ({
start: (callback) => {
value.setValue(config.toValue);
callback && callback({ finished: true });
},
stop: () => ({}),
});
Animated.spring = (value, config) => ({
start: (callback) => {
value.setValue(config.toValue);
callback && callback({ finished: true });
},
stop: () => ({}),
});
jest.mock('./src/client/index');
jest.mock('react-native-reanimated', () => {
const Reanimated = require('react-native-reanimated/mock');
const Easing = {
exp: jest.fn(),
out: jest.fn(),
};
// The mock for `call` immediately calls the callback which is incorrect
// So we override it with a no-op
Reanimated.default.call = () => {};
Reanimated.Easing = Easing;
Reanimated.EasingNode = Easing;
return Reanimated;
});
global.__reanimatedWorkletInit = jest.fn();