components-state-testing.mo
Last updated
Last updated
Create a simple test:
Import the necessary packages and your component:
```javascript
import React from 'react';
import renderer from 'react-test-renderer';
import ComponentToTest from './ComponentToTest.component';
Use this instance in your it
test, the property getInstance()
allows you to access all the properties of the component class. Now you can test your initial state:
Add new tests, faking a user action and the impact it has on the component state: