import { describe, expect, it } from "vitest"; import { readFileSync } from "node:fs"; import { resolve } from "node:path"; const source = readFileSync(resolve(__dirname, "./useProjectNotifications.ts"), "utf8"); const webLayout = readFileSync(resolve(__dirname, "../components/WebLayout.vue"), "utf8"); const desktopLayout = readFileSync(resolve(__dirname, "../components/DesktopLayout.vue"), "utf8"); describe("project notification feed contract", () => { it("uses recipient notifications for both web and desktop reminder bells", () => { expect(source).toContain("listGeneralNotifications"); expect(source).toContain("markGeneralNotificationRead"); expect(source).toContain("markAllGeneralNotificationsRead"); expect(source).toContain('/project/notifications'); expect(source).toContain("POLL_INTERVAL_MS = 60_000"); expect(source).toContain("PROJECT_NOTIFICATIONS_CHANGED_EVENT"); expect(webLayout).toContain("useProjectNotifications()"); expect(desktopLayout).toContain("useProjectNotifications()"); expect(webLayout).not.toContain("fetchOverdueAesCount"); expect(desktopLayout).not.toContain("fetchOverdueAesCount"); expect(webLayout).toContain('command="notification:center"'); expect(desktopLayout).toContain('command="notification:center"'); }); });