https://github.com/jabro86/redux-testing-library
Testing utilities for react and redux applications.
https://github.com/jabro86/redux-testing-library
react redux redux-saga testing
Last synced: 5 months ago
JSON representation
Testing utilities for react and redux applications.
- Host: GitHub
- URL: https://github.com/jabro86/redux-testing-library
- Owner: jabro86
- License: mit
- Created: 2019-05-25T19:48:59.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T22:39:38.000Z (over 3 years ago)
- Last Synced: 2025-10-01T21:55:28.827Z (9 months ago)
- Topics: react, redux, redux-saga, testing
- Language: TypeScript
- Homepage:
- Size: 3.1 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: code-of-conduct.md
Awesome Lists containing this project
README
# redux-testing-library
Simple and maintainable tests for your react/redux application inspired by [react-testing-library](https://testing-library.com/).
[](https://travis-ci.org/jabro86/redux-testing-library)
[](https://coveralls.io/github/jabro86/redux-testing-library?branch=master)
[](https://github.com/prettier/prettier)
[](https://opensource.org/licenses/MIT)
## Features
- simple data-driven integration tests
- dispatch actions, wait for store changes and assert the result
- do not test implementation details: just rely on your actions and selectors
- it also covers all middleware functionalities, e.g. async code via redux-saga
- includes the full power of react-testing-library (no other dependencies)
## How to use?
```typescript
import * as React from "react";
import { render } from "redux-testing-library";
import { TodoApp, TodoActions, TodoSelectors } from "./example";
describe("when addTodo action is dispatched", () => {
it("adds todo item to the store", async () => {
const { store, waitForStoreChange } = render(, TodoApp.store);
store.dispatch(TodoActions.addTodo("Test your application"));
await waitForStoreChange(state => {
const todos = TodoSelectors.getTodos(state);
expect(todos[0].text).toBe("Test your application");
});
});
});
```