Skip to content
Merged
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
Next Next commit
Make tests more reliable
  • Loading branch information
BrunoQuaresma committed Aug 20, 2025
commit 7c4ce4da7b573f70d159e760708adc57c5f7cfee
23 changes: 14 additions & 9 deletions site/src/pages/WorkspacesPage/WorkspacesPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,15 +321,20 @@ describe("WorkspacesPage", () => {

const getWorkspacesSpy = jest.spyOn(API, "getWorkspaces");

getWorkspacesSpy
.mockResolvedValueOnce({
workspaces: workspacesPage1,
count: totalWorkspaces,
})
.mockResolvedValueOnce({
workspaces: workspacesPage2,
count: totalWorkspaces,
});
getWorkspacesSpy.mockImplementation(({ offset }) => {
if (offset === 0) {
return Promise.resolve({
workspaces: workspacesPage1,
count: totalWorkspaces,
});
} else if (offset === 25) {
return Promise.resolve({
workspaces: workspacesPage2,
count: totalWorkspaces,
});
}
return Promise.reject(new Error("Unexpected offset"));
});

const user = userEvent.setup();
renderWithAuth(<WorkspacesPage />);
Expand Down
Loading