@@ -26,7 +26,7 @@ beforeAll(async () => {
2626 process . env . ETH_RPC_URL = 'http://localhost:8545' ;
2727 process . env . KMS_CONTRACT_ADDR = '0x1234567890123456789012345678901234567890' ;
2828 process . env . PORT = '3001' ;
29-
29+
3030 // Import the app after mocking
3131 const indexModule = await import ( './index.ts' ) ;
3232 appFetch = indexModule . default . fetch ;
@@ -58,6 +58,7 @@ describe('API Compatibility Tests', () => {
5858 expect ( data ) . toMatchObject ( {
5959 status : 'ok' ,
6060 kmsContractAddr : '0x1234567890123456789012345678901234567890' ,
61+ ethRpcUrl : 'http://localhost:8545' ,
6162 gatewayAppId : expect . any ( String ) ,
6263 chainId : expect . any ( Number ) ,
6364 appAuthImplementation : expect . any ( String ) ,
@@ -67,7 +68,7 @@ describe('API Compatibility Tests', () => {
6768 // Verify response structure matches OpenAPI spec
6869 const systemInfoSchema = openApiSpec . components . schemas . SystemInfo ;
6970 const requiredFields = systemInfoSchema . required ;
70-
71+
7172 requiredFields . forEach ( field => {
7273 expect ( data ) . toHaveProperty ( field ) ;
7374 } ) ;
@@ -128,7 +129,7 @@ describe('API Compatibility Tests', () => {
128129 // Verify response matches OpenAPI spec
129130 const bootResponseSchema = openApiSpec . components . schemas . BootResponse ;
130131 const requiredFields = bootResponseSchema . required ;
131-
132+
132133 requiredFields . forEach ( field => {
133134 expect ( data ) . toHaveProperty ( field ) ;
134135 } ) ;
@@ -263,7 +264,7 @@ describe('API Compatibility Tests', () => {
263264
264265 it ( 'should not log "Test backend error" messages' , async ( ) => {
265266 const consoleSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
266-
267+
267268 mockReadContract . mockRejectedValue ( new Error ( 'Test backend error' ) ) ;
268269
269270 const response = await appFetch ( new Request ( 'http://localhost:3001/bootAuth/kms' , {
@@ -277,16 +278,16 @@ describe('API Compatibility Tests', () => {
277278 expect ( response . status ) . toBe ( 200 ) ;
278279 expect ( data . isAllowed ) . toBe ( false ) ;
279280 expect ( data . reason ) . toBe ( 'Test backend error' ) ;
280-
281+
281282 // Verify that console.error was not called for test errors
282283 expect ( consoleSpy ) . not . toHaveBeenCalled ( ) ;
283-
284+
284285 consoleSpy . mockRestore ( ) ;
285286 } ) ;
286287
287288 it ( 'should log other error messages' , async ( ) => {
288289 const consoleSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
289-
290+
290291 mockReadContract . mockRejectedValue ( new Error ( 'real error' ) ) ;
291292
292293 const response = await appFetch ( new Request ( 'http://localhost:3001/bootAuth/kms' , {
@@ -300,10 +301,10 @@ describe('API Compatibility Tests', () => {
300301 expect ( response . status ) . toBe ( 200 ) ;
301302 expect ( data . isAllowed ) . toBe ( false ) ;
302303 expect ( data . reason ) . toBe ( 'real error' ) ;
303-
304+
304305 // Verify that console.error was called for real errors
305306 expect ( consoleSpy ) . toHaveBeenCalledWith ( 'error in KMS boot auth:' , expect . any ( Error ) ) ;
306-
307+
307308 consoleSpy . mockRestore ( ) ;
308309 } ) ;
309310 } ) ;
@@ -312,7 +313,7 @@ describe('API Compatibility Tests', () => {
312313describe ( 'API Schema Compatibility' , ( ) => {
313314 it ( 'should match BootInfo schema requirements' , ( ) => {
314315 const bootInfoSchema = openApiSpec . components . schemas . BootInfo ;
315-
316+
316317 // Required fields should match original fastify schema
317318 expect ( bootInfoSchema . required ) . toEqual ( [
318319 'mrAggregated' ,
@@ -331,7 +332,7 @@ describe('API Schema Compatibility', () => {
331332
332333 it ( 'should match BootResponse schema requirements' , ( ) => {
333334 const bootResponseSchema = openApiSpec . components . schemas . BootResponse ;
334-
335+
335336 expect ( bootResponseSchema . required ) . toEqual ( [
336337 'isAllowed' ,
337338 'reason' ,
@@ -341,10 +342,11 @@ describe('API Schema Compatibility', () => {
341342
342343 it ( 'should match SystemInfo schema requirements' , ( ) => {
343344 const systemInfoSchema = openApiSpec . components . schemas . SystemInfo ;
344-
345+
345346 expect ( systemInfoSchema . required ) . toEqual ( [
346347 'status' ,
347348 'kmsContractAddr' ,
349+ 'ethRpcUrl' ,
348350 'gatewayAppId' ,
349351 'chainId' ,
350352 'appAuthImplementation' ,
@@ -385,4 +387,4 @@ describe('Hex Decoding Compatibility', () => {
385387
386388 expect ( response . status ) . toBe ( 200 ) ;
387389 } ) ;
388- } ) ;
390+ } ) ;
0 commit comments