test: set up component snapshot testing (#2102)
* set up snapshot testing
* improvements
* add tests for TextInput as an example
* Fix code style issues with ESLint
* add comment to custom-test-env file
* only set up needed providers
* include style rules in snapshots
* disable redux storage warning
* added setupTests to avoid boilerplate
Co-authored-by:
Lint Action <lint-action@samuelmeuli.com>
Showing
custom-test-env.js
0 → 100644
... | @@ -20,6 +20,8 @@ | ... | @@ -20,6 +20,8 @@ |
"@reach/portal": "^0.10.3", | "@reach/portal": "^0.10.3", | ||
"@react-hook/window-scroll": "^1.3.0", | "@react-hook/window-scroll": "^1.3.0", | ||
"@reduxjs/toolkit": "^1.6.1", | "@reduxjs/toolkit": "^1.6.1", | ||
"@testing-library/jest-dom": "^5.14.1", | |||
"@testing-library/react": "^12.0.0", | |||
"@typechain/ethers-v5": "^7.0.0", | "@typechain/ethers-v5": "^7.0.0", | ||
"@types/d3": "^6.7.1", | "@types/d3": "^6.7.1", | ||
"@types/jest": "^25.2.1", | "@types/jest": "^25.2.1", | ||
... | @@ -77,6 +79,7 @@ | ... | @@ -77,6 +79,7 @@ |
"graphql": "^15.5.0", | "graphql": "^15.5.0", | ||
"graphql-request": "^3.4.0", | "graphql-request": "^3.4.0", | ||
"inter-ui": "^3.13.1", | "inter-ui": "^3.13.1", | ||
"jest-styled-components": "^7.0.5", | |||
"lodash.flatmap": "^4.5.0", | "lodash.flatmap": "^4.5.0", | ||
"luxon": "^1.25.0", | "luxon": "^1.25.0", | ||
"ms.macro": "^2.0.0", | "ms.macro": "^2.0.0", | ||
... | @@ -134,7 +137,7 @@ | ... | @@ -134,7 +137,7 @@ |
"graphql:generate": "graphql-codegen --config codegen.yml", | "graphql:generate": "graphql-codegen --config codegen.yml", | ||
"postinstall": "yarn compile-contract-types", | "postinstall": "yarn compile-contract-types", | ||
"start": "yarn compile-contract-types && react-scripts start", | "start": "yarn compile-contract-types && react-scripts start", | ||
"test": "react-scripts test --env=jsdom", | "test": "react-scripts test --env=./custom-test-env.js", | ||
"prestart": "yarn graphql:generate && touch src/locales/en-US.po" | "prestart": "yarn graphql:generate && touch src/locales/en-US.po" | ||
}, | }, | ||
"eslintConfig": { | "eslintConfig": { | ||
... | ... |
src/setupTests.ts
0 → 100644
src/test-utils.tsx
0 → 100644
Please register or sign in to comment