import reducer from "../../../store/reducers/loading/loadingReducer";
import expect from "expect";
import { setAppReady } from "../../../store/actions/app/appActions";
import { APP_LOADING } from "../../../store/actions/app/appActionConstants";
import { resetLoginState } from "../../../store/actions/login/loginActions";

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

  it("should set loader to true", () => {
    expect(reducer(false, resetLoginState())).toEqual({
      [APP_LOADING]: true,
    });
  });

  it("should set loader to false", () => {
    expect(reducer(true, setAppReady())).toEqual({
      [APP_LOADING]: false,
    });
  });
});
