import { describe, it, expect } from "vitest";
import { mount } from "@vue/test-utils";
import AppEmptyState from "../AppEmptyState.vue";

describe("AppEmptyState", () => {
  it("renders title and message", () => {
    const wrapper = mount(AppEmptyState, {
      props: {
        title: "No items",
        message: "There is nothing here yet.",
      },
    });

    expect(wrapper.text()).toContain("No items");
    expect(wrapper.text()).toContain("There is nothing here yet.");
  });

  it("uses default title when not provided", () => {
    const wrapper = mount(AppEmptyState, {
      props: {
        message: "Something",
      },
    });

    expect(wrapper.text()).toContain("Nothing here");
  });

  it("does not render message paragraph when empty", () => {
    const wrapper = mount(AppEmptyState, {
      props: {
        title: "Only title",
        message: "",
      },
    });

    expect(wrapper.text()).toContain("Only title");
    expect(wrapper.find("p").exists()).toBe(false);
  });
});
