components-state-testing.mo
Owner: Tycho Tatitscheff
Prerequisites (~5 min)
Steps (~30 min)
Create a simple test:
describe('ComponentToTest', () => { it('should test a simple true === true', () => { expect(true).toBe(true); }); });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
ittest, the propertygetInstance()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:
Last updated