import reducer from "../../../../store/reducers/processes/processReducer";
import expect from "expect";
import {
  setDoneProcess,
  setDoneProcessError,
} from "../../../../store/actions/processes/processAction";

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

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

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

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