From 4f060ba7d7d74f03edad4832d7a426fcf6dcac78 Mon Sep 17 00:00:00 2001 From: le king fu Date: Mon, 19 Oct 2026 21:10:03 -0400 Subject: [PATCH] test(i18n): the key guard's canary sees two modules, and lists leaves only (#453) Review 25409, points 1 and 2: the canary now fails if both imports name one file (T4), and a fixture pins that a missing branch is reported by its leaves, never by its container (T1). Co-Authored-By: Claude Opus 5.5 --- src/i18n/locales.keys.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/i18n/locales.keys.test.ts b/src/i18n/locales.keys.test.ts index 8ae7796..03173c0 100644 --- a/src/i18n/locales.keys.test.ts +++ b/src/i18n/locales.keys.test.ts @@ -68,7 +68,9 @@ const EN = nodesOf(en); describe("locale keys: fr.json and en.json (#453)", () => { it("reads both files whole, array items included", () => { - // The canary: an empty or unread file would make the comparison pass on nothing. + // The canary: an empty or unread file would make the comparison pass on + // nothing, and so would one file imported twice. + expect(en, "en.json and fr.json are two modules").not.toBe(fr); for (const [name, nodes] of [["fr.json", FR], ["en.json", EN]] as const) { expect(nodes.get("common.cancel"), name).toBe("leaf"); expect(nodes.get("dashboard.help.tips"), name).toBe("array"); @@ -95,6 +97,8 @@ describe("locale keys: the comparison (#453)", () => { const b = nodesOf({ list: ["one"], only: { b: "y" } }); expect(missingKeys(a, b)).toEqual(["list.1", "only.a"]); expect(missingKeys(b, a)).toEqual(["only.b"]); + // Leaves only: the container `zz` of a missing branch is not listed. + expect(missingKeys(nodesOf({ zz: { only: "x" } }), nodesOf({}))).toEqual(["zz.only"]); }); it("holds an array against an object with the same indices as a gap", () => {