import React from "react";
import { shallow } from "enzyme";
import RaceMode from "../components/screens/GamePanel/RaceMode";

jest.mock("../domain/gameStore");
jest.mock("../domain/apiMethods");
jest.mock("../components/screens/GamePanel/hooks");

import {
  useFirstSubmitter,
  useIsFaded,
} from "../components/screens/GamePanel/hooks";

describe("PositionedStreetView", () => {
  it("renders", () => {
    useFirstSubmitter.mockReturnValue(null);
    useIsFaded.mockReturnValue(false);
    const rendered = shallow(<RaceMode />);
    expect(rendered).toMatchSnapshot();
  });
  it("renders when cut off", () => {
    useFirstSubmitter.mockReturnValue("cutoff-player");
    useIsFaded.mockReturnValue(false);
    const rendered = shallow(<RaceMode cutoffTime={10} />);
    expect(rendered).toMatchSnapshot();
  });
  it("renders when faded", () => {
    useFirstSubmitter.mockReturnValue("cutoff-player");
    useIsFaded.mockReturnValue(true);
    const rendered = shallow(<RaceMode cutoffTime={10} />);
    expect(rendered).toMatchSnapshot();
  });
});
