#!/usr/bin/env node
import {
  SectionProgress
} from "../../chunk-IRJADQM7.js";
import {
  render
} from "../../chunk-66UDJBF6.js";
import {
  afterEach,
  describe,
  globalExpect,
  it
} from "../../chunk-XY3XDVMI.js";
import "../../chunk-FTD5Z6QD.js";
import {
  init_esm_shims
} from "../../chunk-DHET7RCE.js";

// src/cli/components/wizard/section-progress.test.tsx
init_esm_shims();
import { jsx } from "react/jsx-runtime";
describe("SectionProgress component", () => {
  let cleanup;
  afterEach(() => {
    cleanup?.();
    cleanup = void 0;
  });
  describe("rendering", () => {
    it("should render label and current value", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Domain", current: "Web", index: 1, total: 2, next: "API" })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("Domain:");
      globalExpect(output).toContain("Web");
    });
    it("should show correct index/total format", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Skill", current: "react", index: 1, total: 8, next: "zustand" })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("[1/8]");
    });
    it("should show different index/total values", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Domain", current: "API", index: 3, total: 4, next: "Mobile" })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("[3/4]");
    });
  });
  describe("next item display", () => {
    it("should show 'Next: X' when not last item", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Domain", current: "Web", index: 1, total: 2, next: "API" })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("Next: API");
    });
    it("should show 'Last step' when on final item", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Domain", current: "API", index: 2, total: 2 })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("Last step");
      globalExpect(output).not.toContain("Next:");
    });
    it("should show 'Last step' for single item (1/1)", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Domain", current: "Web", index: 1, total: 1 })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("[1/1]");
      globalExpect(output).toContain("Last step");
    });
  });
  describe("text styling", () => {
    it("should render label in bold", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Domain", current: "Web", index: 1, total: 2, next: "API" })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("Domain:");
    });
    it("should render current value with cyan color", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Skill", current: "react", index: 1, total: 3, next: "vue" })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("react");
    });
    it("should render index/total as dim text", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Domain", current: "CLI", index: 2, total: 3, next: "Mobile" })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("[2/3]");
    });
  });
  describe("edge cases", () => {
    it("should handle long label and current value", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(
          SectionProgress,
          {
            label: "Subcategory",
            current: "styled-components",
            index: 1,
            total: 5,
            next: "emotion"
          }
        )
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("Subcategory:");
      globalExpect(output).toContain("styled-components");
    });
    it("should handle large index/total numbers", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(
          SectionProgress,
          {
            label: "Skill",
            current: "some-skill",
            index: 99,
            total: 100,
            next: "last-skill"
          }
        )
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("[99/100]");
      globalExpect(output).toContain("Next: last-skill");
    });
    it("should handle empty next value gracefully", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Domain", current: "Mobile", index: 4, total: 4, next: void 0 })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("Last step");
      globalExpect(output).not.toContain("undefined");
    });
  });
  describe("display variants from spec", () => {
    it("should match multi-domain Build step format", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Domain", current: "Web", index: 1, total: 2, next: "API" })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("Domain:");
      globalExpect(output).toContain("Web");
      globalExpect(output).toContain("[1/2]");
      globalExpect(output).toContain("Next: API");
    });
    it("should match Refine step format", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Skill", current: "react", index: 1, total: 8, next: "zustand" })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("Skill:");
      globalExpect(output).toContain("react");
      globalExpect(output).toContain("[1/8]");
      globalExpect(output).toContain("Next: zustand");
    });
    it("should match last item format", () => {
      const { lastFrame, unmount } = render(
        /* @__PURE__ */ jsx(SectionProgress, { label: "Domain", current: "API", index: 2, total: 2 })
      );
      cleanup = unmount;
      const output = lastFrame();
      globalExpect(output).toContain("Domain:");
      globalExpect(output).toContain("API");
      globalExpect(output).toContain("[2/2]");
      globalExpect(output).toContain("Last step");
    });
  });
});
//# sourceMappingURL=section-progress.test.js.map