Skip to content

Commit 8d3b69a

Browse files
committed
Add check for valid translatable key to unit tests
1 parent ad1779b commit 8d3b69a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/test/internationalization.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { deepEqual as equal, ok } from "assert/strict";
22
import { Application } from "..";
33
import { readdirSync } from "fs";
44
import { join } from "path";
5+
import { translatable } from "../lib/internationalization/translatable";
56

67
describe("Internationalization", () => {
78
let app: Application;
@@ -14,10 +15,10 @@ describe("Internationalization", () => {
1415
});
1516

1617
it("Supports getting the list of supported languages", () => {
17-
equal(
18-
app.internationalization.getSupportedLanguages().sort(),
19-
["en", "zh", "jp", "ko", "test"].sort(),
20-
);
18+
const langs = app.internationalization.getSupportedLanguages();
19+
ok(langs.includes("en"));
20+
ok(langs.includes("ko"));
21+
ok(langs.includes("jp"));
2122
});
2223

2324
it("Supports translating without placeholders", () => {
@@ -62,6 +63,11 @@ describe("Locales", () => {
6263
`${key} translation references "${placeholder[0]}" which will not be available at runtime.`,
6364
);
6465
}
66+
67+
ok(
68+
key in translatable,
69+
`${locale} defines translation key ${key}, which is not available in the default locale.`,
70+
);
6571
}
6672
});
6773
}

0 commit comments

Comments
 (0)