Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit330d91d

Browse files
committed
fix: get workspace tests passing
1 parent86d19b8 commit330d91d

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

‎site/src/hooks/usePagination.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export function usePagination(
1919
):UsePaginationResult{
2020
const{ searchParams, onSearchParamsChange}=options;
2121
constlimit=DEFAULT_RECORDS_PER_PAGE;
22-
constrawPage=Number.parseInt(searchParams.get(paginationKey)||"0",10);
23-
constpage=Number.isNaN(rawPage) ?1 :rawPage;
22+
constrawPage=Number.parseInt(searchParams.get(paginationKey)||"1",10);
23+
constpage=Number.isNaN(rawPage)||rawPage<=0?1 :rawPage;
2424

2525
return{
2626
page,

‎site/src/pages/WorkspacesPage/WorkspacesPage.test.tsx‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import{screen,waitFor,within}from"@testing-library/react";
22
importuserEventfrom"@testing-library/user-event";
33
import{API}from"api/api";
4-
importtype{Workspace}from"api/typesGenerated";
4+
importtype{Template,WorkspacesResponse,Workspace}from"api/typesGenerated";
55
import{http,HttpResponse}from"msw";
66
import{
77
MockDormantOutdatedWorkspace,
@@ -28,18 +28,14 @@ describe("WorkspacesPage", () => {
2828
});
2929

3030
it("renders an empty workspaces page",async()=>{
31-
// Given
3231
server.use(
3332
http.get("/api/v2/workspaces",async()=>{
34-
returnHttpResponse.json({workspaces:[],count:0});
33+
returnHttpResponse.json<WorkspacesResponse>({workspaces:[],count:0});
3534
}),
3635
);
3736

38-
// When
3937
renderWithAuth(<WorkspacesPage/>);
40-
41-
// Then
42-
awaitscreen.findByText("Create a workspace");
38+
awaitscreen.findByRole("heading",{name:/Createaworkspace/});
4339
});
4440

4541
it("renders a filled workspaces page",async()=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp