-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathjest-setup.js
More file actions
47 lines (44 loc) · 1.12 KB
/
jest-setup.js
File metadata and controls
47 lines (44 loc) · 1.12 KB
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
/* eslint-disable no-undef */
import {NativeModules} from 'react-native';
jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter');
jest.mock('@react-native-clipboard/clipboard', () =>
require('@react-native-clipboard/clipboard/jest/clipboard-mock'),
);
process.env.NODE_ENV = 'test';
// For NetworkExamplePage.tsx
global.fetch = jest.fn(() =>
Promise.resolve({
json: () =>
Promise.resolve({
title: 'The Basics - Networking',
description: 'Your app fetched this from a remote endpoint!',
movies: [
{
id: '1',
title: 'Star Wars',
releaseYear: '1977',
},
{
id: '2',
title: 'Back to the Future',
releaseYear: '1985',
},
{
id: '3',
title: 'The Matrix',
releaseYear: '1999',
},
{
id: '4',
title: 'Inception',
releaseYear: '2010',
},
{
id: '5',
title: 'Interstellar',
releaseYear: '2014',
},
],
}),
}),
);