/
UI Testing with Enzyme
UI Testing with Enzyme
Pros:
- Very easy to set up for unit testing regardless of what other testing tools are used
- Does not require a special environment and configuration
- Good documentation and simple API
- Very fast
- Huge community
- Provides facilities for testing the instance of the component directly:
describe('Tags multiselect', () => {
it('should pass correct data options to the Multiselect component', () => {
const tags = [
{ id: '1', label: 'B' },
{ id: '2', label: 'A' },
];
const wrapper = mount(
<Tags
{...baseProps}
tags={tags}
/>
);
const propsPassedToMultselection = wrapper.find(MultiSelection).props();
expect(propsPassedToMultselection.dataOptions).to.deep.equal([
{ value: 'a', label: 'a' },
{ value: 'b', label: 'b' },
]);
});
});
Cons:
- Issues with testing components using react hooks
- Provides facilities for testing the instance of the component directly. This can encourage harmful testing approaches.
, multiple selections available,
Related content
UI Unit testing with Jest/Bigtest
UI Unit testing with Jest/Bigtest
More like this
UI Testing overview
UI Testing overview
More like this
UI Testing Tools
UI Testing Tools
More like this
UI Testing Tools Guidelines Q3 2020
UI Testing Tools Guidelines Q3 2020
More like this
JavaScript Unit tests
JavaScript Unit tests
More like this
UI Testing Tool Evaluation Criteria
UI Testing Tool Evaluation Criteria
More like this