/* eslint-disable no-restricted-syntax -- test fixtures use real display strings, not i18n UI descriptors */ import { describe, expect, test } from "vitest"; import type { AuditListModel } from "@hivegrid/view-models"; import { renderAuditListMock } from "./index.js"; const model: AuditListModel = { titleKey: "audit.viewer.title", emptyHeadlineKey: "audit.viewer.empty.headline", emptyBodyKey: "audit.viewer.empty.body", canExport: true, page: 1, totalPages: 2, rows: [ { id: "audit-1", createdAtIso: "2026-07-06T08:00:00.000Z", actorKindLabelKey: "audit.actorKind.user", actorLabel: "akeshan@example.test", action: "kontakt.updated", outcome: "success", summaryText: "Kontakt umbenannt", summaryKey: "audit.summary.updated", diffCount: 2, hasDetail: true, }, ], rowCount: 1, }; describe("renderAuditListMock (mock impl)", () => { test("carries the impl marker, row data-attributes and the persisted summary", () => { const html = renderAuditListMock(model); expect(html).toContain('data-ui-impl="mock"'); expect(html).toContain('data-ui-id="ui.audit.list"'); expect(html).toContain('data-row-id="audit-1"'); expect(html).toContain('data-diff-count="2"'); expect(html).toContain("Kontakt umbenannt"); expect(html).toContain('data-i18n-key="audit.viewer.title"'); }); test("renders the empty marker without rows", () => { const html = renderAuditListMock({ ...model, rows: [], rowCount: 0 }); expect(html).toContain('data-empty="true"'); expect(html).toContain('data-i18n-key="audit.viewer.empty.headline"'); }); });