import React from "react";
import { render, cleanup } from "@testing-library/react";
import "@testing-library/jest-dom/extend-expect";
import Card from "../";
import Cards from "../cards";

afterEach(cleanup);
describe("Cards", () => {
  it("renders if empty", () => {
    const { getByTestId } = render(
      <Cards data-testid="empty" />
    );
    expect(getByTestId("empty")).toBeInTheDocument()
  });
  it("renders one card", () => {
    const { getByText } = render(
      <Cards>
        <Card>Card</Card>
      </Cards>
    );
    expect(getByText("Card")).toBeInTheDocument()
  });
  it("renders multiple cards", () => {
    const { getByText } = render(
      <Cards>
        <Card>Foo</Card>
        <Card>Bar</Card>
        <Card>Baz</Card>
      </Cards>
    )
    expect(getByText("Foo")).toBeInTheDocument();
    expect(getByText("Bar")).toBeInTheDocument();
    expect(getByText("Baz")).toBeInTheDocument();
  })
});
