mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
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.
This commit is contained in:
1 parent
1564e7c396
commit
8d64da2807
8 files changed
+73
-7
No files matched your search
+2
-1
@@ -10316,7 +10316,8 @@
|
||||
"PRESCRIPTION": "Rezept",
|
||||
"REFERRAL": "Überweisung",
|
||||
"INSURANCE": "Versicherung",
|
||||
"VACCINATION": "Impfung"
|
||||
"VACCINATION": "Impfung",
|
||||
"SICK_NOTE": "Krankschreibung"
|
||||
},
|
||||
"filter": {
|
||||
"searchLabel": "Dokumente durchsuchen",
|
||||
|
||||
+2
-1
@@ -10316,7 +10316,8 @@
|
||||
"PRESCRIPTION": "Prescription",
|
||||
"REFERRAL": "Referral",
|
||||
"INSURANCE": "Insurance",
|
||||
"VACCINATION": "Vaccination"
|
||||
"VACCINATION": "Vaccination",
|
||||
"SICK_NOTE": "Sick note"
|
||||
},
|
||||
"filter": {
|
||||
"searchLabel": "Search documents",
|
||||
|
||||
+2
-1
@@ -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",
|
||||
|
||||
+2
-1
@@ -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",
|
||||
|
||||
+2
-1
@@ -10316,7 +10316,8 @@
|
||||
"PRESCRIPTION": "Prescrizione",
|
||||
"REFERRAL": "Impegnativa",
|
||||
"INSURANCE": "Assicurazione",
|
||||
"VACCINATION": "Vaccinazione"
|
||||
"VACCINATION": "Vaccinazione",
|
||||
"SICK_NOTE": "Certificato di malattia"
|
||||
},
|
||||
"filter": {
|
||||
"searchLabel": "Cerca documenti",
|
||||
|
||||
+2
-1
@@ -10316,7 +10316,8 @@
|
||||
"PRESCRIPTION": "처방",
|
||||
"REFERRAL": "진료 의뢰서",
|
||||
"INSURANCE": "보험",
|
||||
"VACCINATION": "예방접종"
|
||||
"VACCINATION": "예방접종",
|
||||
"SICK_NOTE": "병가 진단서"
|
||||
},
|
||||
"filter": {
|
||||
"searchLabel": "문서 검색",
|
||||
|
||||
+2
-1
@@ -10316,7 +10316,8 @@
|
||||
"PRESCRIPTION": "Recepta",
|
||||
"REFERRAL": "Skierowanie",
|
||||
"INSURANCE": "Ubezpieczenie",
|
||||
"VACCINATION": "Szczepienie"
|
||||
"VACCINATION": "Szczepienie",
|
||||
"SICK_NOTE": "Zwolnienie lekarskie"
|
||||
},
|
||||
"filter": {
|
||||
"searchLabel": "Szukaj dokumentów",
|
||||
|
||||
@@ -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<string, unknown> {
|
||||
const bundle = JSON.parse(
|
||||
readFileSync(join(process.cwd(), "messages", `${locale}.json`), "utf8"),
|
||||
) as { documents?: { kind?: Record<string, unknown> } };
|
||||
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([]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user