Fix image import mocking

This commit is contained in:
MariaZ
2022-09-20 13:36:05 +02:00
parent 726b65914b
commit 57c8e31a9a
4 changed files with 5 additions and 2 deletions
+3
View File
@@ -1,6 +1,9 @@
module.exports = {
preset: '@testing-library/react-native',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
moduleNameMapper: {
'\\.(png)$': require.resolve('./test/file-mock.js'),
},
setupFilesAfterEnv: ['./test/jest-setup.js'],
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native(-.*)?|@react-native(-community)?)/)',
@@ -60,7 +60,7 @@ exports[`Stats screen when provided data, renders stats 1`] = `
}
>
<Image
source="image"
source={123}
style={
Array [
Object {
-1
View File
@@ -6,7 +6,6 @@ import Stats from '../../components/stats'
jest.mock('../../components/common/AppHelp', () => 'AppHelp')
jest.mock('../../components/common/StatsOverview', () => 'StatsOverview')
jest.mock('../../components/common/StatsTable', () => 'StatsTable')
jest.mock('../../assets/cycle-icon.png', () => 'image')
const mockGetAllCycleLengths = jest
.fn()
+1
View File
@@ -0,0 +1 @@
module.exports = 123