import { describe, expect, it } from "vitest"; import { MAIN_ID } from "@banes-lab/web/core/ids/site.ids.ts"; import { attachHome } from "@banes-lab/web/presentation/components/home.component.ts"; import { declaredStyle } from "@banes-lab/web/core/registries/style.registry.ts"; import { mountHome } from "@banes-lab/web/presentation/widgets/home.widget.ts"; class IdleObserver { public observe(): void {} public unobserve(): void {} public disconnect(): void {} } Reflect.set(globalThis, "IntersectionObserver", IdleObserver); Reflect.set(globalThis, "ResizeObserver", IdleObserver); const mounted = function mounted(markup: string): HTMLElement { const main = document.createElement("div"); main.id = MAIN_ID; main.innerHTML = markup; document.body.replaceChildren(main); return main; }; describe("attachHome", () => { it("disposes cleanly when the page carries no rail and no counters", () => { const dispose = attachHome(mounted("")); expect(() => { dispose(); }).not.toThrow(); }); it("leaves a counter at zero until it is seen", () => { const main = mounted('