import reducer from "../../../../store/reducers/processes/processesReducer";
import expect from "expect";
import {
  setProcesses,
  setProcessesError,
} from "../../../../store/actions/processes/processesAction";
import { mockState } from "../../../../mockState";

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

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

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