import reducer from "../../../../store/reducers/pattern/patternApplicantsReducer";
import expect from "expect";
import {
  setPatternApplicants,
  setPatternApplicantsError,
} from "../../../../store/actions/patternApplicants/patternApplicantsActions";
import { mockState } from "../../../../mockState";

describe("patternApplicants reducer", () => {
  it("should return the initial state", () => {
    expect(reducer(undefined, {})).toEqual({
      patternApplicants: [],
      errorMessage: "",
    });
  });

  it("should set the state error", () => {
    expect(reducer(undefined, setPatternApplicantsError("Error"))).toEqual({
      patternApplicants: [],
      errorMessage: "Error",
    });
  });

  it("should set the state success", () => {
    expect(
      reducer(undefined, setPatternApplicants(mockState.patterns.patterns))
    ).toEqual({
      patternApplicants: mockState.patterns.patterns,
      errorMessage: "",
    });
  });
});
