-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.setup.js
120 lines (117 loc) · 2.77 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import mockRNCNetInfo from "@react-native-community/netinfo/jest/netinfo-mock.js";
jest.mock("@react-native-community/netinfo", () => mockRNCNetInfo);
jest.mock("@react-native-async-storage/async-storage", () =>
require("@react-native-async-storage/async-storage/jest/async-storage-mock")
);
jest.mock("@expo/vector-icons", () => {
const { View } = require("react-native");
return {
AntDesign: View,
};
});
jest.mock("@react-navigation/native", () => {
return {
useNavigation: () => {
return {
goBack: () => console.log("Went back"),
navigate: (page) => jest.fn(),
};
},
};
});
jest.mock("aws-amplify", () => {
return {
Auth: {
signOut: () => "",
},
DataStore: {
stop: () => "",
clear: () => "",
},
};
});
jest.mock("react-native/Libraries/Animated/NativeAnimatedHelper");
// local mocks
// ../../crud/UserOperations
jest.mock("./src/crud/UserOperations", () => {
return {
getBio: () => "test bio",
findUserByUsername: () => "",
getUsersbyStartofUsername: () => [],
};
});
jest.mock("./src/crud/CacheOperations", () => {
return {
getCurrentUser: () => "test user",
getUriFromCache: () => "",
cacheRemoteUri: () => "",
deleteAllCache: () => "",
};
});
jest.mock("./src/library/GetAuthenticatedUser", () => {
return {
getCurrentAuthenticatedUser: () => "test user",
};
});
jest.mock("./src/crud/WorkoutOperations", () => {
return {
createWorkout: () => true,
updateWorkoutById: () => true,
deleteWorkout: () => true,
getWorkouts: () => [],
};
});
jest.mock("./src/crud/ReactionOperations", () => {
return {
createReaction: () => "",
getUserReactions: () => [],
removeReaction: () => "",
};
});
jest.mock("./src/crud/observeQueries/ReactionsObserveQueries", () => {
return {
getAndObserveReactions: (postID, setReactions) => {
return {
unsubscribe: jest.fn(),
};
},
};
});
jest.mock("./src/crud/FollowingOperations", () => {
return {
getFollowsList: () => [],
};
});
jest.mock("./src/crud/FollowersOperations", () => {
return {
getFollowersList: () => [],
createFollower: () => true,
};
});
jest.mock("./src/crud/observeQueries/GoalObserveQueries", () => {
return {
getAndObserveGoals: (username, setGoals) => {
setGoals([{ id: "testid", content: "crazy test goal" }]);
return {
unsubscribe: () => jest.fn(),
};
},
};
});
jest.mock("./src/crud/CommentOperations", () => {
return {
checkForDeletability: () => true,
createComment: () => true,
deleteComment: () => true,
};
});
jest.mock("./src/crud/ReactionOperations", () => {
return {
getReactions: () => [],
};
});
jest.mock("./src/crud/GoalOperations", () => {
return {
getGoals: () => [],
};
});