Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

1.1 KB
Raw Blame
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import type { Commit } from "@repowise-dev/types/git";
import { CommitTable } from "../../src/commits/commit-table";

const emptyCommitFeed: Commit[] = [];

describe("commit table empty states", () => {
  it("explains when the unfiltered repository has no indexed commits", () => {
    render(<CommitTable commits={emptyCommitFeed} sort="date" kind="all" />);

    expect(screen.getByText("No commits indexed")).toBeInTheDocument();
  });

  it("keeps the filter chips visible when an active filter has no matches", () => {
    render(
      <CommitTable
        commits={emptyCommitFeed}
        sort="date"
        kind="high"
        onKindChange={() => undefined}
      />,
    );

    expect(screen.getByText("No matches")).toBeInTheDocument();
    expect(screen.queryByText("No commits indexed")).not.toBeInTheDocument();
    expect(screen.getByRole("radio", { name: "All" })).toBeInTheDocument();
    expect(screen.getByRole("radio", { name: "High priority" })).toBeInTheDocument();
  });
});