A
A
anamorph2017-08-14 15:20:30
Software testing
anamorph, 2017-08-14 15:20:30

How to test a React component if Arc.js (atomic design) architecture is used?

There is one big component. This is a form. You need to write tests using Jest, enzyme[, chai]
You need to test validation, the behavior of child components when inputs change, button clicks, etc.
The problem is that the documentation of Arc.js.org only shows examples with shallow render components (shallow), and in order to write such tests, deep rendering (mount) is needed for me.
However, due to the fact that Arc uses not typical imports, but using an algorithm, it collects all components (actions, reducers and ost) into one file and exports from it, then a problem arises, the test cannot correctly render the component until the imports are replaced with relative ones (apparently it perceives them as a module)

import TaxesForm from 'components'   // импорт как в арке
import TaxesForm from './TaxesForm'  //вот так приходится менять

Perhaps there is some more beautiful solution to this problem or a way to solve it?
or maybe if there are working examples of testing large components with Arc.js

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question