33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const routeFiles = [
|
|
"Rows_List.server.tsx",
|
|
"Rows_New.server.ts",
|
|
"Rows_Import.server.ts",
|
|
"Rows_Export.server.ts",
|
|
"Rows_Edit.server.ts",
|
|
"Rows_Overview.server.ts",
|
|
];
|
|
|
|
describe("rows route meta i18n", () => {
|
|
it("uses entity translation helpers for persisted autogenerated labels", () => {
|
|
for (const file of routeFiles) {
|
|
const source = fs.readFileSync(path.resolve(process.cwd(), "apps/web/app/modules/rows/routes", file), "utf8");
|
|
|
|
expect(source).toContain("translateEntityTitle");
|
|
expect(source).not.toContain("t(entity.titlePlural)");
|
|
expect(source).not.toContain("t(entity.title)");
|
|
}
|
|
});
|
|
|
|
it("keeps RowListFetcher slide-over titles helper-based", () => {
|
|
const source = fs.readFileSync(path.resolve(process.cwd(), "apps/web/app/modules/rows/fetchers/RowListFetcher.tsx"), "utf8");
|
|
|
|
expect(source).toContain("translateEntityTitle(t, i18n, data.rowsData.entity)");
|
|
expect(source).not.toContain("t(data?.rowsData?.entity.title");
|
|
});
|
|
});
|