@@ -14,7 +14,7 @@ afterEach(() => {
1414
1515function createMockClient ( ) {
1616 return {
17- GET : vi . fn ( ) . mockImplementation ( ( pathName : string ) => {
17+ GET : vi . fn ( ) . mockImplementation ( ( pathName : string , request ?: { params ?: { query ?: { cursor ?: string } } } ) => {
1818 if ( pathName === "/v1/projects" ) {
1919 return {
2020 data : {
@@ -32,13 +32,25 @@ function createMockClient() {
3232 }
3333
3434 if ( pathName === "/v1/projects/{projectId}/branches" ) {
35+ const cursor = request ?. params ?. query ?. cursor ;
36+ if ( cursor === "cursor_2" ) {
37+ return {
38+ data : {
39+ data : [
40+ { id : "br_feature" , gitName : "feature/auth" , role : "preview" } ,
41+ ] ,
42+ pagination : { hasMore : false , nextCursor : null } ,
43+ } ,
44+ response : { status : 200 } ,
45+ } ;
46+ }
47+
3548 return {
3649 data : {
3750 data : [
3851 { id : "br_main" , gitName : "main" , role : "production" } ,
39- { id : "br_feature" , gitName : "feature/auth" , role : "preview" } ,
4052 ] ,
41- pagination : { hasMore : false , nextCursor : null } ,
53+ pagination : { hasMore : true , nextCursor : "cursor_2" } ,
4254 } ,
4355 response : { status : 200 } ,
4456 } ;
@@ -93,7 +105,13 @@ describe("branch controller", () => {
93105 expect ( client . GET ) . toHaveBeenCalledWith (
94106 "/v1/projects/{projectId}/branches" ,
95107 expect . objectContaining ( {
96- params : { path : { projectId : "proj_123" } } ,
108+ params : { path : { projectId : "proj_123" } , query : { } } ,
109+ } ) ,
110+ ) ;
111+ expect ( client . GET ) . toHaveBeenCalledWith (
112+ "/v1/projects/{projectId}/branches" ,
113+ expect . objectContaining ( {
114+ params : { path : { projectId : "proj_123" } , query : { cursor : "cursor_2" } } ,
97115 } ) ,
98116 ) ;
99117 expect ( result ) . toEqual ( {
0 commit comments