import React from "react";
import { shallow, mount } from "enzyme";
import StartGame from "../components/screens/Lobby/StartGame";

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

import { usePlayerName } from "../domain/gameStore";

describe("StartGame", () => {
  it("renders without crashing", () => {
    usePlayerName.mockReturnValue("test-player");
    const rendered = shallow(<StartGame />);
    expect(rendered).toMatchSnapshot();
  });
  it("responds to clicking the join button", () => {
    usePlayerName.mockReturnValue("test-player");
    const handle = mount(<StartGame />);
    handle.find("button").first().simulate("click");
    expect(handle).toMatchSnapshot();
  });
});
