Hold the one-verb rule in AGENTS.md instead of a unit test
CI / full-gate (push) Successful in 2m38s
Mirror / github-mirror (push) Successful in 6s

This commit was merged in pull request #49.
This commit is contained in:
2026-08-05 00:52:09 +02:00
parent 9a9c63e625
commit 2b09635ed5
3 changed files with 8 additions and 16 deletions
+1 -10
View File
@@ -18,21 +18,12 @@ async function fixture(files: Record<string, string>): Promise<{ localesDir: str
return { localesDir: join(root, "locales"), pluginsDir: join(root, "plugins") };
}
test("the shipped core catalogs load, agree key for key, and use one verb per action", async () => {
test("the shipped core catalogs load and agree key for key", async () => {
const loaded = await loadI18n(); // no args ⇒ the real src/i18n/locales + plugins/
assert.ok(loaded.available.includes("en-US"));
assert.ok(loaded.available.includes("sv-SE"));
assert.deepEqual([...loaded.available].sort(), loaded.available); // sorted, so "sv" resolves deterministically
assert.ok(Object.keys(loaded.core.get("en-US") ?? {}).length > 20);
// One verb per action; inflected too, and the noun ("a sign-in error") is fine. AGENTS.md → Rules.
// The lookbehind spares a path (/login) and a word ending in one (blog in…).
const competing = /(?<![/\w])(log(?:ged|ging)?[\s-]?(?:in|out)|sign(?:ed|ing)?[\s-]?up)s?\b/i;
const offenders = Object.entries(loaded.core.get("en-US") ?? {})
.map(([key, message]) => [key, typeof message === "string" ? message : Object.values(message).join(" ")] as const)
.filter(([, text]) => competing.test(text))
.map(([key, text]) => `${key}: ${text}`);
assert.deepEqual(offenders, []);
});
test("a plugin's catalogs load under its id and may cover fewer locales than the host", async () => {