| 1234567891011121314151617181920212223242526272829303132333435 |
- import reducer from "../../../store/reducers/candidates/candidateOptionsReducer";
- import expect from "expect";
- import {
- fetchCandidateOptionsSuccess,
- fetchCandidateOptionsError,
- } from "../../../store/actions/candidates/candidatesActions";
- import { mockState } from "../../../mockState";
-
- describe("candidatesOptions reducer", () => {
- it("should return the initial state", () => {
- expect(reducer(undefined, {})).toEqual({
- options: [],
- errorMessage: "",
- });
- });
-
- it("should set the state error", () => {
- expect(reducer(undefined, fetchCandidateOptionsError("Error"))).toEqual({
- options: [],
- errorMessage: "Error",
- });
- });
-
- it("should set options", () => {
- expect(
- reducer(
- undefined,
- fetchCandidateOptionsSuccess(mockState.options.options)
- )
- ).toEqual({
- options: mockState.options.options,
- errorMessage: "",
- });
- });
- });
|