From 8d64da28077a6d070937d852603dd4de8f264c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sat, 3 Oct 2026 21:43:37 +0200 Subject: [PATCH] Name the sick note kind in every locale Label SICK_NOTE in all seven bundles and pin that every document kind the database knows has a label in each locale, a place in the vault's kind list and a glyph: the kind reaches the screen through a dynamic key, which the call-site coverage guard cannot see. --- messages/de.json | 3 +- messages/en.json | 3 +- messages/es.json | 3 +- messages/fr.json | 3 +- messages/it.json | 3 +- messages/ko.json | 3 +- messages/pl.json | 3 +- .../__tests__/document-kind-coverage.test.ts | 59 +++++++++++++++++++ 8 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 src/components/documents/__tests__/document-kind-coverage.test.ts diff --git a/messages/de.json b/messages/de.json index 623f3de78..e55d7d7d1 100644 --- a/messages/de.json +++ b/messages/de.json @@ -10316,7 +10316,8 @@ "PRESCRIPTION": "Rezept", "REFERRAL": "Überweisung", "INSURANCE": "Versicherung", - "VACCINATION": "Impfung" + "VACCINATION": "Impfung", + "SICK_NOTE": "Krankschreibung" }, "filter": { "searchLabel": "Dokumente durchsuchen", diff --git a/messages/en.json b/messages/en.json index d1ed93c4a..d150c222a 100644 --- a/messages/en.json +++ b/messages/en.json @@ -10316,7 +10316,8 @@ "PRESCRIPTION": "Prescription", "REFERRAL": "Referral", "INSURANCE": "Insurance", - "VACCINATION": "Vaccination" + "VACCINATION": "Vaccination", + "SICK_NOTE": "Sick note" }, "filter": { "searchLabel": "Search documents", diff --git a/messages/es.json b/messages/es.json index c0f17a81e..490bf1c87 100644 --- a/messages/es.json +++ b/messages/es.json @@ -10316,7 +10316,8 @@ "PRESCRIPTION": "Receta", "REFERRAL": "Derivación", "INSURANCE": "Seguro", - "VACCINATION": "Vacunación" + "VACCINATION": "Vacunación", + "SICK_NOTE": "Baja médica" }, "filter": { "searchLabel": "Buscar documentos", diff --git a/messages/fr.json b/messages/fr.json index c8b7ddd3f..b1bdd8c8e 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -10316,7 +10316,8 @@ "PRESCRIPTION": "Ordonnance", "REFERRAL": "Lettre d'adressage", "INSURANCE": "Assurance", - "VACCINATION": "Vaccination" + "VACCINATION": "Vaccination", + "SICK_NOTE": "Arrêt de travail" }, "filter": { "searchLabel": "Rechercher des documents", diff --git a/messages/it.json b/messages/it.json index cd85c6b40..4b170bea9 100644 --- a/messages/it.json +++ b/messages/it.json @@ -10316,7 +10316,8 @@ "PRESCRIPTION": "Prescrizione", "REFERRAL": "Impegnativa", "INSURANCE": "Assicurazione", - "VACCINATION": "Vaccinazione" + "VACCINATION": "Vaccinazione", + "SICK_NOTE": "Certificato di malattia" }, "filter": { "searchLabel": "Cerca documenti", diff --git a/messages/ko.json b/messages/ko.json index 2ec2108d9..7879563eb 100644 --- a/messages/ko.json +++ b/messages/ko.json @@ -10316,7 +10316,8 @@ "PRESCRIPTION": "처방", "REFERRAL": "진료 의뢰서", "INSURANCE": "보험", - "VACCINATION": "예방접종" + "VACCINATION": "예방접종", + "SICK_NOTE": "병가 진단서" }, "filter": { "searchLabel": "문서 검색", diff --git a/messages/pl.json b/messages/pl.json index d1fa76a78..0c30434c6 100644 --- a/messages/pl.json +++ b/messages/pl.json @@ -10316,7 +10316,8 @@ "PRESCRIPTION": "Recepta", "REFERRAL": "Skierowanie", "INSURANCE": "Ubezpieczenie", - "VACCINATION": "Szczepienie" + "VACCINATION": "Szczepienie", + "SICK_NOTE": "Zwolnienie lekarskie" }, "filter": { "searchLabel": "Szukaj dokumentów", diff --git a/src/components/documents/__tests__/document-kind-coverage.test.ts b/src/components/documents/__tests__/document-kind-coverage.test.ts new file mode 100644 index 000000000..8e753ee8f --- /dev/null +++ b/src/components/documents/__tests__/document-kind-coverage.test.ts @@ -0,0 +1,59 @@ +/** + * Every document kind the database knows is one the vault can file, show and + * name. A kind reaches the screen through a dynamic key + * (`documents.kind.${kind}`), which the call-site coverage guard cannot see, + * so a kind added to the schema without its label would render as a raw key + * in the filter, the bulk bar and the detail sheet. + * + * Mutation check: removing `SICK_NOTE` from any locale's `documents.kind` + * turns the label case red for that locale; dropping it from + * `INBOUND_DOCUMENT_KINDS` turns the parity case red. + */ +import { readFileSync } from "node:fs"; +import { join } from "node:path"; + +import { describe, expect, it } from "vitest"; + +import { InboundDocumentKind } from "@/generated/prisma/enums"; +import { locales } from "@/lib/i18n/config"; +import { INBOUND_DOCUMENT_KINDS } from "@/lib/validations/inbound-documents"; + +import { + DOCUMENT_KIND_ICONS, + DOCUMENT_KIND_ORDER, +} from "../document-kind-meta"; + +function kindLabels(locale: string): Record { + const bundle = JSON.parse( + readFileSync(join(process.cwd(), "messages", `${locale}.json`), "utf8"), + ) as { documents?: { kind?: Record } }; + return bundle.documents?.kind ?? {}; +} + +describe("document kinds", () => { + it("the validation list is exactly the database enum", () => { + expect([...INBOUND_DOCUMENT_KINDS].sort()).toEqual( + Object.values(InboundDocumentKind).sort(), + ); + }); + + it("every kind has a place in the rail and a glyph", () => { + expect([...DOCUMENT_KIND_ORDER].sort()).toEqual( + [...INBOUND_DOCUMENT_KINDS].sort(), + ); + for (const kind of INBOUND_DOCUMENT_KINDS) { + expect(DOCUMENT_KIND_ICONS[kind], kind).toBeDefined(); + } + expect(DOCUMENT_KIND_ORDER.at(-1)).toBe("OTHER"); + }); + + it.each([...locales])("every kind has a label in %s", (locale) => { + const labels = kindLabels(locale); + const missing = INBOUND_DOCUMENT_KINDS.filter( + (kind) => + typeof labels[kind] !== "string" || + (labels[kind] as string).trim() === "", + ); + expect(missing).toEqual([]); + }); +});