import reducer from "../../../../store/reducers/processes/statusUpdateReducer";
import expect from "expect";
import {
  setUpdateStatusReq,
  setUpdateStatusSucc,
  setUpdateStatusErr,
} from "../../../../store/actions/processes/processAction";

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

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

  it("should set the success to true", () => {
    expect(reducer(undefined, setUpdateStatusSucc())).toEqual({
      success: true,
      errorMessage: "",
    });
  });

  it("should set the success to false", () => {
    expect(reducer(undefined, setUpdateStatusReq())).toEqual({
      success: false,
      errorMessage: "",
    });
  });
});
