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

jest.mock("../domain/gameStore");
jest.mock("../hooks/useGameInfo");

import { useGameId } from "../domain/gameStore";
import { useGameCoords, usePlayers } from "../hooks/useGameInfo";

describe("GameSummary", () => {
  it("renders loading when null players", () => {
    useGameId.mockReturnValue("test-game-id");
    useGameCoords.mockReturnValue([]);
    usePlayers.mockReturnValue(null);
    const rendered = shallow(<GameSummary />);
    expect(rendered).toMatchSnapshot();
  });

  it("renders loading when null coords", () => {
    useGameId.mockReturnValue("test-game-id");
    useGameCoords.mockReturnValue(null);
    usePlayers.mockReturnValue([]);
    const rendered = shallow(<GameSummary />);
    expect(rendered).toMatchSnapshot();
  });

  it("renders", () => {
    useGameId.mockReturnValue("test-game-id");
    useGameCoords.mockReturnValue([]);
    usePlayers.mockReturnValue([]);
    const rendered = shallow(<GameSummary />);
    expect(rendered).toMatchSnapshot();
  });
});
