import React from "react";
import { shallow } from "enzyme";
import App, { Header, Footer, paramRouter, State } from "../App";

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

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

describe("App", () => {
  it("renders", () => {
    const rendered = shallow(<App />);
    expect(rendered).toMatchSnapshot();
  });

  describe("Header", () => {
    it("renders", () => {
      const rendered = shallow(<Header />);
      expect(rendered).toMatchSnapshot();
    });
  });

  describe("Footer", () => {
    it("renders", () => {
      const rendered = shallow(<Footer />);
      expect(rendered).toMatchSnapshot();
    });
  });

  describe("paramRouter", () => {
    it("routes summary param", () => {
      paramRouter.summary("test-game-id");
      expect(dispatch.goToSummary).toMatchSnapshot();
    });
  });

  describe("State", () => {
    it("renders", () => {
      const rendered = shallow(<State>Test</State>);
      expect(rendered).toMatchSnapshot();
    });
  });
});
