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 editor UI copy behind translation keys", () => {
|
|
const editor = fs.readFileSync(path.join(repoRoot, "apps/web/app/components/screens/forms/FormEditorPage.tsx"), "utf8");
|
|
const responses = fs.readFileSync(path.join(repoRoot, "apps/web/app/components/screens/forms/editor/ResponsesTab.tsx"), "utf8");
|
|
|
|
expect(editor).toContain('t("settings.forms.editor.header.autosave.saved")');
|
|
expect(editor).toContain('t("settings.forms.editor.tabs.questions")');
|
|
expect(responses).toContain('t("settings.forms.editor.responses.title")');
|
|
expect(editor).not.toContain('placeholder="https://www.example.com"');
|
|
});
|
|
|
|
it("formats submission timestamps through locale helpers", () => {
|
|
const route = fs.readFileSync(path.join(repoRoot, "apps/web/app/routes/app.$tenant/forms.$id.tsx"), "utf8");
|
|
const responses = fs.readFileSync(path.join(repoRoot, "apps/web/app/components/screens/forms/editor/ResponsesTab.tsx"), "utf8");
|
|
|
|
expect(route).toContain("useLocaleFormatters");
|
|
expect(route).toContain("formatters.dateTime(value");
|
|
expect(responses).toContain("<time dateTime={submission.createdAt}");
|
|
expect(responses).toContain("formatDateTime(submission.createdAt)");
|
|
});
|
|
});
|