https://github.com/or13/testing-react-redux-graphql
https://github.com/or13/testing-react-redux-graphql
apollo encryption graphql jest mock pokemon react redux
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/or13/testing-react-redux-graphql
- Owner: OR13
- Created: 2017-12-11T17:19:01.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-11T20:17:45.000Z (over 8 years ago)
- Last Synced: 2025-04-07T17:47:53.245Z (about 1 year ago)
- Topics: apollo, encryption, graphql, jest, mock, pokemon, react, redux
- Language: JavaScript
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Testing React Redux & GraphQL
```
yarn install
yarn mock:clean
yarn mock:gen
yarn test
yarn start
```
`yarn mock:clean` deletes mock data used by graphql tests.
`yarn mock:gen` generates data to be used by graphql tests and saves the data to a file.
This makes it possible to test without making real network requests.
`yarn test` and select `a` to run all tests. These tests verify the component, and the graphql container using the generated mock data.
`yarn start` run the app in devlopment mode.
## Motivation
It is desirable to test react components, redux containers and graphql functionality in isolation and integration.
This create-react-app derived app shows how components, redux and graphql containers can all be tested.
It also shows how mock data can be retrieved via real network requests and then used in subsequent tests. This enables developers to adjust to data changes easily.