import { describe, expect, test } from "vitest"; import { assertI18nLabel } from "./index.js"; // Targets the descriptionKey validation branch of assertI18nLabel (index.ts:96-98), // which the existing index.test.ts never exercises (it only passes a labelKey). describe("assertI18nLabel descriptionKey validation", () => { test("accepts a label whose optional descriptionKey is a valid i18n key", () => { const label = { labelKey: "shell.nav.home", descriptionKey: "shell.nav.home.desc" }; expect(assertI18nLabel(label)).toBe(label); }); test("rejects a non-i18n descriptionKey even when the labelKey is valid", () => { expect(() => assertI18nLabel({ labelKey: "shell.nav.home", descriptionKey: "Plain Text" })).toThrow( /descriptions must use i18n keys/i, ); }); test("error message names the offending descriptionKey", () => { expect(() => assertI18nLabel({ labelKey: "a.b", descriptionKey: "BAD_KEY" })).toThrow(/BAD_KEY/); }); });