import { describe, it, expect } from "vitest"; import { mount } from "@vue/test-utils"; import { Network } from "lucide-vue-next"; import PageHeader from "../PageHeader.vue"; describe("PageHeader", () => { it("renders title + subtitle", () => { const wrapper = mount(PageHeader, { props: { title: "Resolvers", subtitle: "Interface layer" }, }); expect(wrapper.text()).toContain("Resolvers"); expect(wrapper.text()).toContain("Interface layer"); }); it("renders the count badge when total is set", () => { const wrapper = mount(PageHeader, { props: { title: "Resolvers", count: 3, total: 10 }, }); expect(wrapper.get("[data-testid=page-count]").text()).toBe("3 / 10"); }); it("falls back to total when count is undefined", () => { const wrapper = mount(PageHeader, { props: { title: "Resolvers", total: 10 }, }); expect(wrapper.get("[data-testid=page-count]").text()).toBe("10 / 10"); }); it("renders the lucide icon when supplied", () => { const wrapper = mount(PageHeader, { props: { title: "Resolvers", icon: Network }, }); expect(wrapper.findComponent(Network).exists()).toBe(true); }); it("omits the count badge when total is undefined", () => { const wrapper = mount(PageHeader, { props: { title: "Resolvers" }, }); expect(wrapper.find("[data-testid=page-count]").exists()).toBe(false); }); });