28 lines
1.4 KiB
TypeScript
28 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const repoRoot = process.cwd();
|
|
|
|
describe("form detail i18n formatting", () => {
|
|
it("keeps the form admin allowed-origin placeholder behind a translation key", () => {
|
|
const source = fs.readFileSync(path.join(repoRoot, "apps/web/app/routes/app.$tenant/forms.tsx"), "utf8");
|
|
const en = fs.readFileSync(path.join(repoRoot, "apps/web/public/locales/en/translations.json"), "utf8");
|
|
const de = fs.readFileSync(path.join(repoRoot, "apps/web/public/locales/de/translations.json"), "utf8");
|
|
|
|
expect(source).toContain('placeholder={t("settings.forms.admin.create.allowedOriginPlaceholder")}');
|
|
expect(source).not.toContain('placeholder="https://www.example.com"');
|
|
expect(en).toContain('"allowedOriginPlaceholder": "https://www.example.com"');
|
|
expect(de).toContain('"allowedOriginPlaceholder": "https://www.example.com"');
|
|
});
|
|
|
|
it("formats submission timestamps through locale helpers", () => {
|
|
const source = fs.readFileSync(path.join(repoRoot, "apps/web/app/routes/app.$tenant/forms.$id.tsx"), "utf8");
|
|
|
|
expect(source).toContain("useLocaleFormatters");
|
|
expect(source).toContain("formatters.dateTime(s.createdAt");
|
|
expect(source).toContain("<time dateTime={s.createdAt}");
|
|
expect(source).not.toContain("<span>{s.createdAt}</span>");
|
|
});
|
|
});
|