Hold the one-verb rule in AGENTS.md instead of a unit test
This commit was merged in pull request #49.
This commit is contained in:
+1
-10
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user