This repository has been archived by the owner on Dec 3, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #28: WIP - Add initial Jest test for a React component.
* Adds Jest/Enzyme and the first part of a simple React component test. * Adds a 'commerce' alias for Jest/Enzyme tests for React components to match the 'commerce' alias used in Webpack. * Questions: * How to get around the CSS import in Accordion.jsx? I currently have it commented out. * Is it possible for me to webpack the './test' directory? Would I want to? What might that look like? * How can I render the original '<Accordion />', instead of explicitly passing it two '<AccordionSection />' elements in the test? 'Accordion.jsx' renders two AccordionSections already with their own 'this.props.children'. * How can I fix the prop-types errors for required props? Do I just have to 'monkey patch' these components and pass dummy props into the components in the test? * Should I use 'babel-preset-env', so that I can use 'import' in the test files? These tests run in Node.js, and currently, Node.js v8 still does not support 'import'. * Jest docs (https://jestjs.io/docs/en/webpack) suggest using mocks for static assets. I followed their Webpack instrucions for this, but I'm not sure I follow what the mock files are actually for/doing.
- Loading branch information