import React from "react";
import { configure, shallow, render } from "enzyme";
import Adapter from "enzyme-adapter-react-16";
import EfeCard from "../components/card/Card";
import { colors, cardSize } from "../constants/variables";

configure({ adapter: new Adapter() });

describe("Card Value Test", () => {
  const component = shallow(
    <EfeCard
      title={"Bilge Adam Başlık"}
      description={"Bilge Adam Açıklama"}
      date={"Bilge Adam Altbilgi"}
    />
  );
  test("Card Title Value Test", () => {
    expect(component.find(".efe-card-title").text()).toEqual(
      "Bilge Adam Başlık"
    );
  });

  test("Card Description Value Test", () => {
    expect(component.find(".efe-card-description").text()).toEqual(
      "Bilge Adam Açıklama"
    );
  });

  test("Card Description Value Test", () => {
    expect(component.find(".efe-card-footer").text()).toEqual(
      "Bilge Adam Altbilgi"
    );
  });
});

describe("Card Size Test", () => {
  for (let index = 0; index < cardSize.length; index++) {
    test(`Card size value:${cardSize[index]}`, () => {
      const component = shallow(
        <EfeCard
          title={"Bilge Adam Başlık"}
          description={"Bilge Adam Açıklama"}
          size={cardSize[index]}
        />
      );
      expect(component.find(`.efe-card-${cardSize[index]}`)).toHaveLength(1);
    });
  }
});
