Lines Matching refs:test

11 … you'll learn how to set up Jest in your project, write a unit test, write a snapshot test, and be…
29 "test": "jest"
73 ## Unit test
75 A unit test is used to check the smallest unit of code, usually a function.
77test, start by writing a simple test for **App.js**. Create a test file for it and call it **App.t…
79 The test will expect the state of the `<App />` component to have one child element:
81 ```js App.test.js
83 import renderer from 'react-test-renderer';
97 To run the test:
99 <Terminal cmd={['$ npm run test']} />
101 If everything goes well, you should see the one test passed. For more information, see [expect and …
105 Right now, you have a single test file in the project directory. Adding more test files can make it…
111 '__tests__/components/button.test.js',
112 '__tests__/navigation/mainstack.test.js',
113 '__tests__/screens/home.test.js',
122 …ories for different areas of your project. For example, create a separate test directory for **com…
124 <FileTree files={['src/components/button.js', 'src/components/__tests__/button.test.js']} />
126 …components** directory, the import path of `<Button>` in the the **button.test.js** will be `../bu…
128 Another option for test/file structure:
134 'src/components/button.test.js',
140 ## Snapshot test
142 A snapshot test is used to make sure that UI stays consistent, especially when a project is working…
144 To add a snapshot test for `<App />`, add the following code snippet in the `describe()` in **App.t…
146 ```js App.test.js
153 Run `npm run test` command, and if everything goes well, you should see a snapshot created and two …
177 Run `npm run test`. You should see a **coverage** directory created in your project. Find the **ind…
189 "test": "jest --watch --coverage=false --changedSince=origin/main",
197 // when a screen/component is updated, the test snapshots will throw an error, this updates them