@@ -17,7 +17,12 @@ describe("checkServerHealth", () => {
1717 const headers : Array < string | null > = [ ]
1818 const fetch = ( async ( _input : RequestInfo | URL , init ?: RequestInit ) => {
1919 headers . push ( new Headers ( init ?. headers ) . get ( "authorization" ) )
20- return Response . json ( { version : "2.0.0" , pid : 1 , urls : [ server . url ] } )
20+ return Response . json ( {
21+ version : "2.0.0" ,
22+ pid : 1 ,
23+ urls : [ server . url ] ,
24+ paths : { tmp : "/tmp/opencode" } ,
25+ } )
2126 } ) as typeof globalThis . fetch
2227
2328 expect ( await checkServerHealth ( { ...server , password } , fetch ) ) . toEqual ( { healthy : true , version : "2.0.0" } )
@@ -28,16 +33,19 @@ describe("checkServerHealth", () => {
2833 let request : URL | undefined
2934 const fetch = ( async ( input : RequestInfo | URL ) => {
3035 request = input instanceof URL ? input : new URL ( input instanceof Request ? input . url : input )
31- return new Response ( JSON . stringify ( { version : "1.2.3" , pid : 1 , urls : [ server . url ] } ) , {
32- status : 200 ,
33- headers : { "content-type" : "application/json" } ,
34- } )
36+ return new Response (
37+ JSON . stringify ( { version : "1.2.3" , pid : 1 , urls : [ server . url ] , paths : { tmp : "/tmp/opencode" } } ) ,
38+ {
39+ status : 200 ,
40+ headers : { "content-type" : "application/json" } ,
41+ } ,
42+ )
3543 } ) as unknown as typeof globalThis . fetch
3644
3745 const result = await checkServerHealth ( server , fetch )
3846
3947 expect ( result ) . toEqual ( { healthy : true , version : "1.2.3" } )
40- expect ( request ?. pathname ) . toBe ( "/api/status " )
48+ expect ( request ?. pathname ) . toBe ( "/api/info " )
4149 } )
4250
4351 test ( "allows slow servers thirty seconds by default" , async ( ) => {
@@ -52,7 +60,7 @@ describe("checkServerHealth", () => {
5260 } )
5361
5462 const fetch = ( async ( ) =>
55- new Response ( JSON . stringify ( { version : "1.2.3" , pid : 1 , urls : [ server . url ] } ) , {
63+ new Response ( JSON . stringify ( { version : "1.2.3" , pid : 1 , urls : [ server . url ] , paths : { tmp : "/tmp/opencode" } } ) , {
5664 status : 200 ,
5765 headers : { "content-type" : "application/json" } ,
5866 } ) ) as unknown as typeof globalThis . fetch
@@ -111,10 +119,13 @@ describe("checkServerHealth", () => {
111119 let signal : AbortSignal | undefined
112120 const fetch = ( async ( input : RequestInfo | URL , init ?: RequestInit ) => {
113121 signal = abortFromInput ( input , init )
114- return new Response ( JSON . stringify ( { version : "1.2.3" , pid : 1 , urls : [ server . url ] } ) , {
115- status : 200 ,
116- headers : { "content-type" : "application/json" } ,
117- } )
122+ return new Response (
123+ JSON . stringify ( { version : "1.2.3" , pid : 1 , urls : [ server . url ] , paths : { tmp : "/tmp/opencode" } } ) ,
124+ {
125+ status : 200 ,
126+ headers : { "content-type" : "application/json" } ,
127+ } ,
128+ )
118129 } ) as unknown as typeof globalThis . fetch
119130
120131 const abort = new AbortController ( )
@@ -130,10 +141,13 @@ describe("checkServerHealth", () => {
130141 const fetch = ( async ( ) => {
131142 count += 1
132143 if ( count < 3 ) throw new TypeError ( "network" )
133- return new Response ( JSON . stringify ( { version : "1.2.3" , pid : 1 , urls : [ server . url ] } ) , {
134- status : 200 ,
135- headers : { "content-type" : "application/json" } ,
136- } )
144+ return new Response (
145+ JSON . stringify ( { version : "1.2.3" , pid : 1 , urls : [ server . url ] , paths : { tmp : "/tmp/opencode" } } ) ,
146+ {
147+ status : 200 ,
148+ headers : { "content-type" : "application/json" } ,
149+ } ,
150+ )
137151 } ) as unknown as typeof globalThis . fetch
138152
139153 const result = await checkServerHealth ( server , fetch , {
0 commit comments