-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.setup.js
90 lines (87 loc) · 2.13 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
jest.mock('react-native-reanimated', () => {
const View = require('react-native').View;
const Text = require('react-native').Text;
return {
Value: jest.fn(),
event: jest.fn(),
add: jest.fn(),
eq: jest.fn(),
set: jest.fn(),
cond: jest.fn(),
interpolate: jest.fn(),
View: (props) => <View {...props} />,
Text: (props) => <Text {...props} />,
createAnimatedComponent: (cb) => cb,
Extrapolate: { CLAMP: jest.fn() },
Transition: {
Together: 'Together',
Out: 'Out',
In: 'In',
},
useSharedValue: jest.fn(),
useDerivedValue: (a) => ({ value: a() }),
useAnimatedScrollHandler: () => () => {},
useAnimatedGestureHandler: () => () => {},
useAnimatedStyle: (cb) => cb(),
useAnimatedRef: () => ({ current: null }),
useAnimatedReaction: (value, cb) => cb(value(), ''),
useAnimatedProps: (cb) => cb(),
withTiming: (toValue, _, cb) => {
cb && cb(true);
return toValue;
},
withSpring: (toValue, _, cb) => {
cb && cb(true);
return toValue;
},
withDecay: (_, cb) => {
cb && cb(true);
return 0;
},
withDelay: (_, animationValue) => {
return animationValue;
},
withSequence: (..._animations) => {
return 0;
},
withRepeat: (animation, _, __, cb) => {
cb();
return animation;
},
cancelAnimation: () => {},
measure: () => ({
x: 0,
y: 0,
width: 0,
height: 0,
pageX: 0,
pageY: 0,
}),
Easing: {
linear: (cb) => cb(),
ease: (cb) => cb(),
quad: (cb) => cb(),
cubic: (cb) => cb(),
poly: (cb) => cb(),
sin: (cb) => cb(),
circle: (cb) => cb(),
exp: (cb) => cb(),
elastic: (cb) => cb(),
back: (cb) => cb(),
bounce: (cb) => cb(),
bezier: () => ({ factory: (cb) => cb() }),
bezierFn: (cb) => cb(),
steps: (cb) => cb(),
in: (cb) => cb(),
out: (cb) => cb(),
inOut: (cb) => cb(),
},
Extrapolation: {
EXTEND: 'extend',
CLAMP: 'clamp',
IDENTITY: 'identity',
},
runOnJS: (fn) => fn,
runOnUI: (fn) => fn,
};
});