import React from "react";
import { describe, it, expect } from "vitest";
import { render } from "ink-testing-library";
import { Tabs } from "../src/components/Tabs.js";
const noop = () => {};
describe("Tabs", () => {
it("renders the default visible tabs (auth + logging shown, requests hidden)", () => {
const { lastFrame } = render(
,
);
const frame = lastFrame() ?? "";
expect(frame).toContain("Info");
expect(frame).toContain("Auth");
expect(frame).toContain("Console");
expect(frame).toContain("Protocol");
// Network defaults to hidden
expect(frame).not.toContain("Network");
});
it("hides the auth tab when showAuth is false", () => {
const { lastFrame } = render(
,
);
expect(lastFrame() ?? "").not.toContain("Auth");
});
it("hides the logging tab when showLogging is false", () => {
const { lastFrame } = render(
,
);
expect(lastFrame() ?? "").not.toContain("Console");
});
it("shows the requests tab when showRequests is true", () => {
const { lastFrame } = render(
,
);
expect(lastFrame() ?? "").toContain("Network");
});
it("marks the active tab with the ▶ marker", () => {
const { lastFrame } = render(
,
);
expect(lastFrame() ?? "").toContain("▶");
});
it("renders counts when provided and omits them otherwise", () => {
const withCounts = render(
,
);
const frame = withCounts.lastFrame() ?? "";
expect(frame).toContain("(3)");
// count of 0 is defined, so it still renders
expect(frame).toContain("(0)");
});
it("highlights the focused active tab", () => {
const { lastFrame } = render(
,
);
// focused active tab path renders without error and shows the marker
expect(lastFrame() ?? "").toContain("▶");
});
});