Files
HiveGrid-Wireframes/hivegrid-cloud/apps/web/app/components/entities/rows/row-empty-states-i18n.test.ts
T

41 lines
1.7 KiB
TypeScript

import fs from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";
const rowsRoot = path.resolve(process.cwd(), "apps/web/app/components/entities/rows");
function readRowComponent(relativePath: string) {
return fs.readFileSync(path.join(rowsRoot, relativePath), "utf8");
}
describe("row empty and error states i18n", () => {
it("uses semantic translation keys for logs and unsupported values", () => {
const sources = [readRowComponent("RowLogs.tsx"), readRowComponent("RowValueInput.tsx")].join("\n");
expect(sources).toContain("models.row.logs.noEvents");
expect(sources).toContain("models.row.values.unknownFormula");
expect(sources).toContain("models.row.values.notSupported");
expect(sources).not.toContain("no_events_e339ba73");
expect(sources).not.toContain("unknown_formula_f4bd1420");
expect(sources).not.toContain("not_supported_8e635455");
});
it("keeps row tag form copy on translated labels", () => {
const source = readRowComponent("RowSettingsTags.tsx");
expect(source).toContain("shared.tagNamePlaceholder");
expect(source).toContain('title={t("shared.tag")}');
expect(source).not.toContain('title="shared.tag"');
expect(source).not.toContain('t("shared.tagName") + "..."');
});
it("keeps row activity timestamps on locale-aware formatters", () => {
const sources = [readRowComponent("RowLogs.tsx"), readRowComponent("RowActivity.tsx"), readRowComponent("RowLogComment.tsx")].join("\n");
expect(sources).toContain("useLocaleFormatters");
expect(sources).toContain("formatters.relativeDate");
expect(sources).toContain("formatters.dateTime");
expect(sources).not.toContain("DateUtils");
});
});