Skip to content

Commit

Permalink
fix: jest mock NativeModules
Browse files Browse the repository at this point in the history
  • Loading branch information
1uokun committed Feb 17, 2023
1 parent 342aeba commit d3e2253
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
rules: {
'react-native/no-inline-styles': 0,
semi: [1, 'never'],
'@typescript-eslint/no-unused-vars': 1,
'@typescript-eslint/no-unused-vars': [1, { args: 'none' }],
},
env: {
browser: true,
Expand Down
3 changes: 3 additions & 0 deletions components/picker/__tests__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ Array [
},
]
}
numberOfLines={1}
onChange={[Function]}
selectedIndex={0}
style={
Expand Down Expand Up @@ -276,6 +277,7 @@ Array [
},
]
}
numberOfLines={1}
onChange={[Function]}
selectedIndex={0}
style={
Expand Down Expand Up @@ -312,6 +314,7 @@ Array [
},
]
}
numberOfLines={1}
onChange={[Function]}
selectedIndex={0}
style={
Expand Down
10 changes: 8 additions & 2 deletions jestSetup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
import 'react-native-gesture-handler/jestSetup';
import 'react-native-gesture-handler/jestSetup'

jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper')

jest.mock('react-native', () => {
const RN = jest.requireActual('react-native')
RN.NativeModules.RNCCameraRollPermissionModule = {}
return RN
})

0 comments on commit d3e2253

Please sign in to comment.