Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(tests): update issue page tests for new header and view store shape

Naiyuan Qing6b93e3ba9ccf
diff --git a/apps/web/app/(dashboard)/issues/[id]/page.test.tsx b/apps/web/app/(dashboard)/issues/[id]/page.test.tsx
index 7d335a8e68..36a2dba359 100644
--- a/apps/web/app/(dashboard)/issues/[id]/page.test.tsx
+++ b/apps/web/app/(dashboard)/issues/[id]/page.test.tsx
@@ -195,8 +195,8 @@ describe("IssueDetailPage", () => {
await waitFor(() => {
expect(
- screen.getByText("Implement authentication"),
- ).toBeInTheDocument();
+ screen.getAllByText("Implement authentication").length,
+ ).toBeGreaterThanOrEqual(1);
});
expect(
@@ -302,10 +302,10 @@ describe("IssueDetailPage", () => {
await renderPage();
await waitFor(() => {
- expect(screen.getByText("Issues")).toBeInTheDocument();
+ expect(screen.getByText("Test WS")).toBeInTheDocument();
});
- const issuesLink = screen.getByText("Issues");
- expect(issuesLink.closest("a")).toHaveAttribute("href", "/issues");
+ const wsLink = screen.getByText("Test WS");
+ expect(wsLink.closest("a")).toHaveAttribute("href", "/issues");
});
});
diff --git a/apps/web/app/(dashboard)/issues/page.test.tsx b/apps/web/app/(dashboard)/issues/page.test.tsx
index 6866d60f1e..ad28a8006b 100644
--- a/apps/web/app/(dashboard)/issues/page.test.tsx
+++ b/apps/web/app/(dashboard)/issues/page.test.tsx
@@ -105,10 +105,20 @@ const mockViewState = {
viewMode: "board" as const,
statusFilters: [] as string[],
priorityFilters: [] as string[],
+ sortBy: "position" as const,
+ sortDirection: "asc" as const,
+ cardProperties: { priority: true, description: true, assignee: true, dueDate: true },
+ listCollapsedStatuses: [] as string[],
setViewMode: vi.fn(),
toggleStatusFilter: vi.fn(),
togglePriorityFilter: vi.fn(),
+ hideStatus: vi.fn(),
+ showStatus: vi.fn(),
clearFilters: vi.fn(),
+ setSortBy: vi.fn(),
+ setSortDirection: vi.fn(),
+ toggleCardProperty: vi.fn(),
+ toggleListCollapsed: vi.fn(),
};
vi.mock("@/features/issues/stores/view-store", () => ({
@@ -116,6 +126,19 @@ vi.mock("@/features/issues/stores/view-store", () => ({
(selector?: any) => (selector ? selector(mockViewState) : mockViewState),
{ getState: () => mockViewState, setState: vi.fn() },
),
+ SORT_OPTIONS: [
+ { value: "position", label: "Manual" },
+ { value: "priority", label: "Priority" },
+ { value: "due_date", label: "Due date" },
+ { value: "created_at", label: "Created date" },
+ { value: "title", label: "Title" },
+ ],
+ CARD_PROPERTY_OPTIONS: [
+ { key: "priority", label: "Priority" },
+ { key: "description", label: "Description" },
+ { key: "assignee", label: "Assignee" },
+ { key: "dueDate", label: "Due date" },
+ ],
}));
// Mock issue config
@@ -162,6 +185,8 @@ vi.mock("@dnd-kit/core", () => ({
}));
vi.mock("@dnd-kit/sortable", () => ({
+ SortableContext: ({ children }: any) => children,
+ verticalListSortingStrategy: {},
useSortable: () => ({
attributes: {},
listeners: {},
@@ -306,8 +331,8 @@ describe("IssuesPage", () => {
render(<IssuesPage />);
- expect(screen.getByText("Status: All")).toBeInTheDocument();
- expect(screen.getByText("Priority: All")).toBeInTheDocument();
+ expect(screen.getByText("Filter")).toBeInTheDocument();
+ expect(screen.getByText("Display")).toBeInTheDocument();
});
it("shows empty board view when no issues exist", () => {