@@ -51,7 +51,9 @@ describe('HelloState component', () => {
51
51
// mounted component can be selected via its name, function, or JSX
52
52
// e.g. '@HelloState', HelloState, or <HelloState />
53
53
cy .get (HelloState).invoke (' setState' , { name: ' React' })
54
- cy .get (HelloState).its (' state' ).should (' deep.equal' , { name: ' React' })
54
+ cy .get (HelloState)
55
+ .its (' state' )
56
+ .should (' deep.equal' , { name: ' React' })
55
57
// check if GUI has rerendered
56
58
cy .contains (' Hello React!' )
57
59
})
@@ -98,7 +100,7 @@ import './styles.css'
98
100
You can read the CSS file and pass it as ` style ` option yourself
99
101
100
102
``` js
101
- cy .readFile (' cypress/integration/Button.css' ).then (( style ) => {
103
+ cy .readFile (' cypress/integration/Button.css' ).then (style => {
102
104
cy .mount (< Button name= " Orange" orange / > , { style })
103
105
})
104
106
```
@@ -172,7 +174,7 @@ If you already have a plugins file, you can use a file preprocessor that points
172
174
``` js
173
175
// your project's Cypress plugin file
174
176
const craFilePreprocessor = require (' cypress-react-unit-test/plugins/cra-v3/file-preprocessor' )
175
- module .exports = ( on ) => {
177
+ module .exports = on => {
176
178
on (' file:preprocessor' , craFilePreprocessor ())
177
179
}
178
180
```
@@ -197,6 +199,9 @@ All components are in [src](src) folder. All tests are in [cypress/integration](
197
199
- [ bahmutov/calculator] ( https://github.com/bahmutov/calculator ) tests multiple components: calculator App, Button, Display.
198
200
- [ bahmutov/react-todo-with-hooks] ( https://github.com/bahmutov/react-todo-with-hooks ) branch ` added-tests `
199
201
- [ bahmutov/test-redux-examples] ( https://github.com/bahmutov/test-redux-examples ) branch ` mount2 `
202
+ - [ bahmutov/test-react-hooks-animations] ( https://github.com/bahmutov/test-react-hooks-animations ) react hooks with spring animations test
203
+
204
+ To find more examples, see GitHub topic [ cypress-react-unit-test-example] ( https://github.com/topics/cypress-react-unit-test-example )
200
205
201
206
## Development
202
207
0 commit comments