// IMP-41 u3 — Vitest coverage for application_mode helper (issue #70). // // Scope (Stage 2 unit u3 contract): // 1) buildBadgeTitle: composite output for each known mode + legacy fallback // (undefined applicationMode) + unknown fallback (string not in // APPLICATION_MODE_TOOLTIP_KR). // 2) mergeApplicationCandidates: array → Map // semantics, including skip-missing-key and empty-input. // // Pure helper unit test — no React, no DOM, no fetch. Aligns with the // AI-isolation contract: assertions key by backend application_mode VALUE, // never by V4 label. import { describe, it, expect } from "vitest"; import { buildBadgeTitle, mergeApplicationCandidates, APPLICATION_MODE_TOOLTIP_KR, } from "../src/services/applicationMode"; describe("buildBadgeTitle (IMP-41 u3)", () => { it("returns composite ' ()' for direct_insert", () => { expect(buildBadgeTitle("use_as_is", "direct_insert")).toBe( `${APPLICATION_MODE_TOOLTIP_KR.direct_insert} (direct_insert)`, ); }); it("returns composite output for same_frame_with_adjustment", () => { expect( buildBadgeTitle("light_edit", "same_frame_with_adjustment"), ).toBe( `${APPLICATION_MODE_TOOLTIP_KR.same_frame_with_adjustment} (same_frame_with_adjustment)`, ); }); it("returns composite output for layout_or_region_change", () => { expect( buildBadgeTitle("restructure", "layout_or_region_change"), ).toBe( `${APPLICATION_MODE_TOOLTIP_KR.layout_or_region_change} (layout_or_region_change)`, ); }); it("returns composite output for exclude", () => { expect(buildBadgeTitle("reject", "exclude")).toBe( `${APPLICATION_MODE_TOOLTIP_KR.exclude} (exclude)`, ); }); it("falls back to 'V4 label: