39 lines · 1.2 KB · TypeScript
RawDownload
import { ThreadId } from "@t3tools/contracts";import { renderToStaticMarkup } from "react-dom/server";import { describe, expect, it } from "vite-plus/test"; import { ThreadWorktreeIndicator } from "./ThreadStatusIndicators"; describe("ThreadWorktreeIndicator", () => {  it("renders the worktree folder and branch in an accessible label", () => {    const markup = renderToStaticMarkup(      <ThreadWorktreeIndicator        thread={{          id: ThreadId.make("thread-1"),          branch: "feature/sidebar-indicator",          worktreePath: "/tmp/worktrees/sidebar-indicator",        }}      />,    );     expect(markup).toContain('role="img"');    expect(markup).toContain(      'aria-label="Worktree: sidebar-indicator (feature/sidebar-indicator)"',    );    expect(markup).toContain('data-testid="thread-worktree-thread-1"');  });   it.each([null, "", "   "])("renders nothing for an absent worktree path", (worktreePath) => {    const markup = renderToStaticMarkup(      <ThreadWorktreeIndicator        thread={{          id: ThreadId.make("thread-1"),          branch: "main",          worktreePath,        }}      />,    );     expect(markup).toBe("");  });});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t