fix(tests): update issue page tests for new header and view store shape
- Add missing view-store mock fields (sortBy, sortDirection, cardProperties, listCollapsedStatuses, toggleListCollapsed) and exported constants - Add SortableContext mock to @dnd-kit/sortable - Fix filter button assertions (Status/Priority: All → Filter/Display) - Fix issue detail test: use getAllByText for duplicate title text - Fix breadcrumb test: workspace name shown instead of "Issues" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
572d033b95
commit
6b93e3ba9c
2 changed files with 32 additions and 7 deletions
|
|
@ -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");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue