Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improve tests
  • Loading branch information
BrunoQuaresma committed Aug 21, 2025
commit 275116b3621bf23c604cae70f40d0948fb5b1c9e
26 changes: 10 additions & 16 deletions site/src/pages/WorkspacesPage/WorkspacesPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,11 @@ describe("WorkspacesPage", () => {
expect(screen.getByText("page1-workspace-0")).toBeInTheDocument();
});

expect(getWorkspacesSpy).toHaveBeenNthCalledWith(
1,
expect.objectContaining({
q: "owner:me",
offset: 0,
limit: 25,
}),
);
expect(getWorkspacesSpy).toHaveBeenLastCalledWith({
q: "owner:me",
offset: 0,
limit: 25,
});

const nextPageButton = screen.getByRole("button", { name: /next page/i });
await user.click(nextPageButton);
Expand All @@ -361,14 +358,11 @@ describe("WorkspacesPage", () => {
expect(screen.getByText("page2-workspace-0")).toBeInTheDocument();
});

expect(getWorkspacesSpy).toHaveBeenNthCalledWith(
2,
expect.objectContaining({
q: "owner:me",
offset: 25,
limit: 25,
}),
);
expect(getWorkspacesSpy).toHaveBeenLastCalledWith({
q: "owner:me",
offset: 25,
limit: 25,
});

expect(screen.queryByText("page1-workspace-0")).not.toBeInTheDocument();
});
Expand Down
3 changes: 2 additions & 1 deletion site/src/pages/WorkspacesPage/WorkspacesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ const WorkspacesPage: FC = () => {
});

const workspacesQueryOptions = workspaces({
...pagination,
limit: pagination.limit,
offset: pagination.offset,
q: filterState.filter.query,
});
const { data, error, refetch } = useQuery({
Expand Down
Loading