import { afterEach, expect, it, vi } from "vitest"; import { mount, flushPromises } from "@vue/test-utils"; import { defineComponent, h, type Component } from "vue"; const demos = import.meta.glob("../apps/docs/demos/calendar-*.vue", { eager: true, import: "default", }) as Record; const wrappers: ReturnType[] = []; afterEach(() => { wrappers.splice(0).forEach((w) => w.unmount()); document.body.innerHTML = ""; vi.restoreAllMocks(); }); it("mounts all nineteen baseline demos together without duplicate IDs or Vue warnings", async () => { expect(Object.keys(demos)).toHaveLength(19); const warn = vi.spyOn(console, "warn").mockImplementation(() => {}); const w = mount( defineComponent({ render: () => h( "div", Object.entries(demos).map(([key, demo]) => h(demo, { key })), ), }), { attachTo: document.body }, ); wrappers.push(w); await flushPromises(); const ids = Array.from(document.querySelectorAll("[id]")).map((e) => e.id); expect(new Set(ids).size).toBe(ids.length); expect(warn).not.toHaveBeenCalled(); });