As I have tested my application which has navigation that has png images in node modules but tests are failing.
Source codes of App.js
import React from 'react';
import {SafeAreaView} from 'react-native';
import {styles} from './src/assets/styles';
import {AppStack} from './src/components/navs/stacks/AppStack';
const App = () => {
//TODO: Designing ui for spend and scheduled :progress
// doing list of data from utils/index.js :done
//fech those data to screen that needs them
return (
<SafeAreaView style={styles.app}>
<AppStack />
</SafeAreaView>
);
};
export default App;
App-test.js
import 'react-native';
import React from 'react';
import App from '../App';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
renderer.create(<App />);
});
Expected Result: Test should render my App entry point which is is App.js Actual Result
Janviers-MacBook-Pro:credex janvier$ npm test
> credex@0.0.1 test
> jest
FAIL __tests__/App-test.js
● Test suite failed to run
/Volumes/D/Coding/credex/node_modules/@react-navigation/elements/lib/commonjs/assets/back-icon.png:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){�PNG
SyntaxError: Invalid or unexpected token
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
at Object.<anonymous> (node_modules/@react-navigation/elements/lib/commonjs/index.tsx:20:3)