import { describe, expect, test } from "vitest"; import type { NotificationCenterModel } from "@hivegrid/view-models"; import { renderNotificationCenterMock } from "./index.js"; const model: NotificationCenterModel = { titleKey: "notifications.center.title", emptyHeadlineKey: "notifications.center.empty", emptyBodyKey: "notifications.center.emptyHelper", totalCount: 2, unreadCount: 1, items: [ { id: "delivery-1", messageKey: "team.invite.created", statusKey: "notifications.center.statuses.sent", categoryKey: "notifications.center.categories.team", isRead: false, bounceKey: null, deeplinkHref: "/acme/settings/members", }, { id: "delivery-2", messageKey: "billing.invoice.failed", statusKey: "notifications.center.statuses.read", categoryKey: "notifications.center.categories.billing", isRead: true, bounceKey: "notifications.center.bounce.rateLimited", deeplinkHref: null, }, ], }; describe("renderNotificationCenterMock (mock impl)", () => { test("carries the impl marker, unread count, deeplink and bounce key attributes", () => { const html = renderNotificationCenterMock(model); expect(html).toContain('data-ui-impl="mock"'); expect(html).toContain('data-ui-id="ui.notifications.center"'); expect(html).toContain('data-unread-count="1"'); expect(html).toContain('data-deeplink="/acme/settings/members"'); expect(html).toContain('data-bounce-key="notifications.center.bounce.rateLimited"'); expect(html).toContain('data-i18n-key="team.invite.created"'); }); test("renders the empty marker without items", () => { const html = renderNotificationCenterMock({ ...model, items: [], totalCount: 0, unreadCount: 0 }); expect(html).toContain('data-empty="true"'); expect(html).toContain('data-i18n-key="notifications.center.empty"'); }); });