// The Lucia project.
// Copyright 2026-2026 DSP, inc.  All rights reserved.
// Authors:
//   imacat.yang@dsp.im (imacat), 2026/03/05

import { describe, it, expect } from "vitest";
import { mapPageNameToCapitalUnifiedName } from "@/utils/pageUtils.js";

describe("pageUtils", () => {
  describe("mapPageNameToCapitalUnifiedName", () => {
    it("converts CheckMap to MAP", () => {
      expect(mapPageNameToCapitalUnifiedName("CheckMap")).toBe("MAP");
    });

    it("converts CheckConformance to CONFORMANCE", () => {
      expect(mapPageNameToCapitalUnifiedName("CheckConformance")).toBe(
        "CONFORMANCE",
      );
    });

    it("converts CheckPerformance to PERFORMANCE", () => {
      expect(mapPageNameToCapitalUnifiedName("CheckPerformance")).toBe(
        "PERFORMANCE",
      );
    });

    it("converts CompareDashboard to PERFORMANCE", () => {
      expect(mapPageNameToCapitalUnifiedName("CompareDashboard")).toBe(
        "PERFORMANCE",
      );
    });

    it("converts other names to uppercase", () => {
      expect(mapPageNameToCapitalUnifiedName("files")).toBe("FILES");
      expect(mapPageNameToCapitalUnifiedName("Map")).toBe("MAP");
    });

    it("handles case-insensitive input", () => {
      expect(mapPageNameToCapitalUnifiedName("checkmap")).toBe("MAP");
      expect(mapPageNameToCapitalUnifiedName("CHECKMAP")).toBe("MAP");
    });

    it("returns undefined for falsy input", () => {
      expect(mapPageNameToCapitalUnifiedName(undefined)).toBeUndefined();
      expect(mapPageNameToCapitalUnifiedName(null)).toBeUndefined();
      expect(mapPageNameToCapitalUnifiedName("")).toBeUndefined();
    });
  });
});
