This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Jest | |
# | |
.jest/ | |
coverage/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Enzyme from "enzyme"; | |
import Adapter from "enzyme-adapter-react-16"; | |
global.fetch = require("jest-fetch-mock"); | |
Enzyme.configure({ adapter: new Adapter() }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"extends": "./tsconfig", | |
"compilerOptions": { | |
"jsx": "react", | |
"module": "commonjs" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"jest": { | |
"preset": "react-native", | |
"transform": { | |
"^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js", | |
"^.+\\.tsx?$": "ts-jest" | |
}, | |
"globals": { | |
"ts-jest": { | |
"tsConfigFile": "tsconfig.jest.json" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AppRegistry } from "react-native"; | |
import App from "./app/App"; | |
import { name as appName } from "./app.json"; | |
AppRegistry.registerComponent(appName, () => App); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import App from './App'; | |
import { shallow, ShallowWrapper } from 'enzyme'; | |
import React from 'react'; | |
import { View } from 'react-native'; | |
const createTestProps = (props: Object) => ({ | |
...props | |
}); | |
describe("App", () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"parser": "babel-eslint", | |
"env": { | |
"browser": true, | |
"jest": true | |
}, | |
"plugins": ["react"], | |
"extends": ["eslint:recommended", "plugin:react/recommended"], | |
"rules": {}, | |
"globals": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... your other imports | |
import LocalizedStrings from 'react-native-localization'; | |
let strings = new LocalizedStrings({ | |
en: { | |
welcome: "Welcome to React Native!", | |
instructions: "To get started, edit App.tsx", | |
instructionsIOS: "Press Cmd+R to reload,\n" + "Cmd+D or shake for dev menu", | |
instructionsAndroid: "Double tap R on your keyboard to reload,\n" + "Shake or press menu button for dev menu" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const instructions = Platform.select({ | |
ios: strings.instructionsIOS, | |
android: strings.instructionsAndroid | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<View style={styles.container}> | |
<Text style={styles.welcome}>{strings.welcome}</Text> | |
<Text style={styles.instructions}>{strings.instructions}</Text> | |
<Text style={styles.instructions}>{instructions}</Text> | |
</View> |
OlderNewer