import reducer from "../../../../store/reducers/ad/archiveAdsReducer";
import expect from "expect";
import {
  setArchiveAds,
  setArchiveAdsError,
} from "../../../../store/actions/archiveAds/archiveAdsActions";
import { mockState } from "../../../../mockState";

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

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

  it("should set the state success", () => {
    expect(reducer(undefined, setArchiveAds(mockState.ads.ads))).toEqual({
      archiveAds: mockState.ads.ads,
      errorMessage: "",
    });
  });
});
