import { readFile } from "node:fs/promises"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; describe("LeadsPage initial loading", () => { it("loads leads when the page is mounted", async () => { const source = await readFile(fileURLToPath(new URL("./LeadsPage.vue", import.meta.url)), "utf8"); expect(source).toMatch(/onMounted\(load\)/); }); it("keeps the grouped lead detail layout hooks", async () => { const source = await readFile(fileURLToPath(new URL("./LeadsPage.vue", import.meta.url)), "utf8"); expect(source).toContain('class="lead-detail-card"'); expect(source).toContain('class="lead-detail-item"'); expect(source).toContain('class="lead-detail-section-title"'); expect(source).toContain('class="lead-detail-section lead-detail-note"'); expect(source.match(/class="lead-detail-item"/g)).toHaveLength(6); expect(source).toContain("v-permission=\"'admin:leads:update'\""); }); });