-
Notifications
You must be signed in to change notification settings - Fork 232
/
jest.setup.js
28 lines (25 loc) · 707 Bytes
/
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
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
/* eslint-env jest */
import { NativeModules } from 'react-native';
// Mock the RNCGeolocation native module to allow us to unit test the JavaScript code
NativeModules.RNCGeolocation = {
addListener: jest.fn(),
getCurrentPosition: jest.fn(),
removeListeners: jest.fn(),
requestAuthorization: jest.fn(),
setConfiguration: jest.fn(),
startObserving: jest.fn(),
stopObserving: jest.fn(),
};
// Reset the mocks before each test
global.beforeEach(() => {
jest.resetAllMocks();
});