forked from pagopa/io-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjestSetup.js
42 lines (35 loc) · 1.39 KB
/
jestSetup.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
/**
* Set up of the testing environment
*/
import { NativeModules } from "react-native";
import mockAsyncStorage from "@react-native-community/async-storage/jest/async-storage-mock";
import mockClipboard from "@react-native-clipboard/clipboard/jest/clipboard-mock.js";
NativeModules.RNGestureHandlerModule = {
attachGestureHandler: jest.fn(),
createGestureHandler: jest.fn(),
dropGestureHandler: jest.fn(),
updateGestureHandler: jest.fn(),
forceTouchAvailable: jest.fn(),
State: {},
Directions: {}
};
jest.mock("@react-native-community/async-storage", () => mockAsyncStorage);
jest.mock("@react-native-community/push-notification-ios", jest.fn());
jest.mock("react-native-permissions", jest.fn());
jest.mock("@react-native-community/cookies", jest.fn());
jest.mock("react-native-share", () => jest.fn());
jest.mock("@react-native-clipboard/clipboard", () => mockClipboard);
/**
* adds as for documentation suggestion
* https://docs.swmansion.com/react-native-reanimated/docs/1.x.x/getting_started/#testing
*/
jest.mock("react-native-reanimated", () => {
const Reanimated = require("react-native-reanimated/mock");
// The mock misses the `addWhitelistedUIProps` implementation
// So we override it with a no-op
Reanimated.default.addWhitelistedUIProps = () => {};
return Reanimated;
});
NativeModules.PlatformConstants = NativeModules.PlatformConstants || {
forceTouchAvailable: false
};