Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/apps/web/app/routes/app.$tenant/activity-summary-i18n.test.ts
T

40 lines
1.5 KiB
TypeScript

import { readFileSync } from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { resolveRepoPath } from "~/utils/testing/repoPaths";
function routeSource(relativePath: string): string {
return readFileSync(path.join(resolveRepoPath("apps/web/app/routes/app.$tenant"), relativePath), "utf8");
}
describe("core route activity summary i18n contract", () => {
it("persists semantic keys for lead activities instead of request-locale text", () => {
const sources = ["leads.new.tsx", "leads.$id.tsx", "leads._index.tsx", "leads.board.tsx"]
.map(routeSource)
.join("\n");
for (const key of ["leads.activity.created", "leads.activity.updated", "leads.activity.convertRequested", "activity.runtime.leads.statusChanged"]) {
expect(sources).toContain(`summaryText: "${key}"`);
}
expect(sources).not.toMatch(/summaryText:\s*t\("leads\.activity\./u);
});
it("persists semantic keys for every email-marketing activity", () => {
const sources = [
"email-marketing/segments.tsx",
"email-marketing/campaigns/new.tsx",
"email-marketing/campaigns/$id.tsx",
"email-marketing/sending-domain.tsx",
].map(routeSource).join("\n");
for (const suffix of [
"segmentCreated",
"campaignDraftCreated",
"scheduleCancelled",
"campaignScheduled",
"campaignSendStarted",
"sendingDomainConfigured",
]) {
expect(sources).toContain(`activity.runtime.emailMarketing.${suffix}`);
}
});
});