jeudi 23 mai 2019

React - testing components

I should start with implementing tests for my React application. Root project folders consists of components, containers, reducers, actions, helpers, views etc. I assume, only containers and components should be tested, and eventually helpers functions? Views are just wrapper components that only render corresponding containers, so there is no special code. Should they be tested? And what my tests should consist of? Snapshots, unit tests etc?

Assume I have user view (component that just renders userContainer). Then in container, I render header-toolbar component, filters-toolbar component and users-list-table component bellow. There are also few buttons that trigger new-user/edit-user modal component that contains add-new-user-form component,delete-user etc. And there are few methods, like onFormSubmit, toggleModal, onFilterChange, renderModalTitle etc. Also, there are some actions connected to container component through props.

What would be the flow of testing such chained components?

Aucun commentaire:

Enregistrer un commentaire