import reducer from "../../../../store/reducers/processes/applicantWithProcessesReducer";
import expect from "expect";
import {
  setApplicant,
  setApplicantError
} from "../../../../store/actions/processes/applicantAction";
import { mockState } from "../../../../mockState";

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

  it("should set the state error", () => {
    expect(reducer(undefined, setApplicantError("Error"))).toEqual({
      applicant: {},
      errorMessage: "Error",
    });
  });

  it("should set the state success", () => {
    expect(
      reducer(undefined, setApplicant(mockState.candidate.candidate))
    ).toEqual({
      applicant: mockState.candidate.candidate,
      errorMessage: "",
    });
  });
});
