-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathtutorialHelpTranslations.test.ts
More file actions
61 lines (56 loc) · 1.7 KB
/
tutorialHelpTranslations.test.ts
File metadata and controls
61 lines (56 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { describe, expect, it } from "vitest";
import { type Locale, SUPPORTED_LOCALES } from "@/i18n/config";
import enDialogs from "@/i18n/locales/en/dialogs.json";
import esDialogs from "@/i18n/locales/es/dialogs.json";
import frDialogs from "@/i18n/locales/fr/dialogs.json";
import koKRDialogs from "@/i18n/locales/ko-KR/dialogs.json";
import ruDialogs from "@/i18n/locales/ru/dialogs.json";
import trDialogs from "@/i18n/locales/tr/dialogs.json";
import zhCNDialogs from "@/i18n/locales/zh-CN/dialogs.json";
const tutorialHelpKeys = [
"triggerLabel",
"title",
"description",
"explanationBefore",
"remove",
"explanationMiddle",
"covered",
"explanationAfter",
"visualExample",
"removed",
"kept",
"part1",
"part2",
"part3",
"finalVideo",
"step1Title",
"step1DescriptionBefore",
"step1DescriptionAfter",
"step2Title",
"step2Description",
] as const;
const keysThatMayBeEmpty = new Set<(typeof tutorialHelpKeys)[number]>(["step1DescriptionBefore"]);
const dialogsByLocale = {
en: enDialogs,
"zh-CN": zhCNDialogs,
es: esDialogs,
fr: frDialogs,
tr: trDialogs,
"ko-KR": koKRDialogs,
ru: ruDialogs,
} satisfies Record<Locale, { tutorial: Record<string, unknown> }>;
describe("TutorialHelp translations", () => {
it("defines every tutorial help key for each supported locale", () => {
for (const locale of SUPPORTED_LOCALES) {
const tutorial = dialogsByLocale[locale].tutorial;
for (const key of tutorialHelpKeys) {
const message = tutorial[key];
const label = `${locale} dialogs.tutorial.${key}`;
expect(message, label).toEqual(expect.any(String));
if (!keysThatMayBeEmpty.has(key)) {
expect((message as string).trim().length, label).toBeGreaterThan(0);
}
}
}
});
});