import reducer from "../../../store/reducers/stats/statsReducer";
import expect from "expect";
import {
  getStatsError,
  getStatsSuccess,
} from "../../../store/actions/stats/statsActions";

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

  it("should set error message", () => {
    expect(reducer(undefined, getStatsError("Error"))).toEqual({
      stats: {},
      fetchStatsErrorMessage: "Error",
    });
  });

  it("Should set state stats", () => {
    expect(reducer(undefined, getStatsSuccess({ data: "mockData" }))).toEqual({
      stats: { data: "mockData" },
      fetchStatsErrorMessage: "",
    });
  });
});
