32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
// @vitest-environment node
|
|
|
|
import { readFileSync } from "node:fs";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const SOURCES = [
|
|
"hrService.server.ts",
|
|
"hrLeaveService.server.ts",
|
|
"hrPayslipService.server.ts",
|
|
"hrRequestService.server.ts",
|
|
"hrSickLeaveService.server.ts",
|
|
].map((file) => readFileSync(`apps/web/app/utils/integrations/${file}`, "utf8"));
|
|
|
|
describe("HR activity i18n contract", () => {
|
|
it("persists semantic keys for every machine-authored HR summary", () => {
|
|
const summaries = SOURCES.flatMap((source) =>
|
|
[...source.matchAll(/summaryText:\s*"([^"]+)"/gu)].map((match) => match[1]),
|
|
);
|
|
|
|
expect(summaries).toEqual(
|
|
expect.arrayContaining([
|
|
"activity.runtime.hr.documentUploaded",
|
|
"activity.runtime.hr.leaveRequested",
|
|
"activity.runtime.hr.payslipProvided",
|
|
"activity.runtime.hr.requestSubmitted",
|
|
"activity.runtime.hr.sickLeaveRecorded",
|
|
]),
|
|
);
|
|
expect(summaries.every((summary) => summary.startsWith("activity.runtime.hr."))).toBe(true);
|
|
});
|
|
});
|