speaq-ai / react-ui

Production React UI for Speak-ai.
0 stars 1 forks source link

Unit Tests for basic functionality #22

Closed jacobpa closed 4 years ago

forsman5 commented 4 years ago

For reviewing this, how should I run the tests locally / ensure that they're not running out of memory? or does that only happen on travis?

jacobpa commented 4 years ago

@forsman5 The setup test file just configures enzyme to run properly with jest. Enzyme is a utility from Airbnb which allows for more in-depth testing of React components. We are using it in our project as an "almost integration" test. You can see it in use in the tests for components that I've written so far, it's utility is that it allows us to verify the status of elements within a component, and to also simulate interactions with components (clicking buttons, etc.)

As far as running the tests locally, you can feel free to do so, but for the purposes of merging Travis will re-run all tests that reflect the most recent commit in a PR, and will block merging until all tests passed for the most recent commit. The heap memory errors occur much less frequently locally (and this will depend on your system specifications), but it won't hurt to try it locally.

I have increased the memory allocated to webpack in Travis to avoid this error, and you can see the environment environment variable in the travis configuration file, which you can also use locally. We are running out of memory due to the sheer number of components being processed, I have tweaked our build/develop configuration a minor amount to use fewer resources (webpack.config.js), but the error still persists on Travis.