Skip to content

Commit e119a74

Browse files
committed
fix(test): new way to integrate with async storage mock
1 parent 218753a commit e119a74

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
"./testenv.js"
162162
],
163163
"transformIgnorePatterns": [
164-
"node_modules/(?!(jest-)?react-native|react-navigation)"
164+
"node_modules/(?!(jest-)?react-native|react-navigation|@react-native-community)"
165165
],
166166
"moduleNameMapper": {
167167
"styled-components": "<rootDir>/node_modules/styled-components/dist/styled-components.native.cjs.js"

testenv.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'react-native';
22
import 'react-native-mock';
3+
import mockAsyncStorage from '@react-native-community/async-storage/jest/async-storage-mock';
34
import Enzyme from 'enzyme';
45
import Adapter from 'enzyme-adapter-react-16';
56

@@ -26,6 +27,8 @@ jest.mock('react-native-i18n', () => {
2627
};
2728
});
2829

30+
jest.mock('@react-native-community/async-storage', () => mockAsyncStorage);
31+
2932
jest.mock('react-native-communications', () => ({
3033
web: jest.fn(),
3134
email: jest.fn(),

0 commit comments

Comments
 (0)