2.0.2 • Published 5 years ago

redux-testing-library v2.0.2

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

redux-testing-library

Simple and maintainable tests for your react/redux application inspired by react-testing-library.

Build Status Coverage Status code style: prettier License: 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?

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.UI />, 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");
    });
  });
});
2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago