Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/johnpooch/redux-middleware-example-app
https://github.com/johnpooch/redux-middleware-example-app
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/johnpooch/redux-middleware-example-app
- Owner: johnpooch
- Created: 2022-01-17T16:19:16.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-19T11:08:04.000Z (about 3 years ago)
- Last Synced: 2024-11-11T17:48:23.153Z (2 months ago)
- Language: TypeScript
- Size: 587 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RTK Query Example App
This is an example app to demonstrate adding basic tests to a simple [RTK Query][rtk-query] implementation.
## Tests
* The test script [here][service-tests] provides an approach for adding basic tests to your RTK Query service. The tests cover success and error scenarios a query endpoint and a mutation endpoint.
* The test script [here][hooks-tests] provides an approach for adding tests for your RTK Query service's automatically generated React hooks.
* There are some [other tests][tests-dir] which demonstrate testing basic redux functionality like selectors and actions.## Prerequisites
Install dev requirements by running `yarn` in the project root.
## Running the tests
In the project root run `yarn test`.
## Starting the app
This project includes a very primitive applcation which exercises the RTK Query implementation. The implementation uses [MSW][msw] as a mock service. You can alter the behavior of the mock service [here][handlers]
In the project root run `yarn start`. The application will be available on port 3000 by default.
[rtk-query]: https://redux-toolkit.js.org/rtk-query/overview
[msw]: https://mswjs.io/
[tests-dir]: https://github.com/johnpooch/rtk-query-example-app/tree/main/src/store/__tests__
[service-tests]: https://github.com/johnpooch/rtk-query-example-app/tree/main/src/store/__tests__/service.test.ts
[hooks-tests]: https://github.com/johnpooch/rtk-query-example-app/blob/main/src/hooks/__tests__/service.test.tsx
[handlers]: https://github.com/johnpooch/rtk-query-example-app/blob/main/src/mockService/handlers.js