@@ -54,6 +54,11 @@ describe('ACP server test', { timeout: 40_000 }, () => {
5454
5555 await codexAcpAgent . initialize ( { protocolVersion : 1 } ) ;
5656 await fixture . getCodexAcpClient ( ) . logout ( ) ;
57+
58+
59+ const unauthenticatedResponse = await fixture . getCodexAcpAgent ( ) . extMethod ( "authentication/status" , { } ) ;
60+ expect ( unauthenticatedResponse ) . toEqual ( { type : "unauthenticated" } ) ;
61+
5762 fixture . clearCodexConnectionDump ( ) ;
5863
5964 const authRequest : CodexAuthRequest = { methodId : "api-key" , _meta : { "api-key" : { apiKey : "TOKEN" } } }
@@ -63,6 +68,13 @@ describe('ACP server test', { timeout: 40_000 }, () => {
6368
6469 const transportDump = fixture . getCodexConnectionDump ( [ ...ignoredFields , "upgrade" ] ) ;
6570 await expect ( transportDump ) . toMatchFileSnapshot ( "data/auth-with-key.json" ) ;
71+
72+ const authenticatedResponse = await fixture . getCodexAcpAgent ( ) . extMethod ( "authentication/status" , { } ) ;
73+ expect ( authenticatedResponse ) . toEqual ( { type : "api-key" } ) ;
74+
75+ await fixture . getCodexAcpAgent ( ) . extMethod ( "authentication/logout" , { } ) ;
76+ const logoutResponse = await fixture . getCodexAcpAgent ( ) . extMethod ( "authentication/status" , { } ) ;
77+ expect ( logoutResponse ) . toEqual ( { type : "unauthenticated" } ) ;
6678 } ) ;
6779
6880 it ( 'should authenticate with a gateway' , async ( ) => {
@@ -86,6 +98,9 @@ describe('ACP server test', { timeout: 40_000 }, () => {
8698 await codexAcpAgent . authenticate ( authRequest ) ;
8799 expect ( await fixture . getCodexAcpClient ( ) . authRequired ( ) ) . toBe ( false ) ;
88100
101+ const authenticatedResponse = await fixture . getCodexAcpAgent ( ) . extMethod ( "authentication/status" , { } ) ;
102+ expect ( authenticatedResponse ) . toEqual ( { type : "gateway" , name : "custom-gateway" } ) ;
103+
89104 const newSessionResponse = await codexAcpAgent . newSession ( { cwd : "" , mcpServers : [ ] } ) ;
90105 expect ( newSessionResponse . sessionId ) . toBeDefined ( )
91106 } )
@@ -358,7 +373,7 @@ describe('ACP server test', { timeout: 40_000 }, () => {
358373
359374 const sessionState : SessionState = createTestSessionState ( ) ;
360375
361- const logoutSpy = vi . spyOn ( mockFixture . getCodexAcpClient ( ) , "logout" ) . mockResolvedValue ( undefined ) ;
376+ const logoutSpy = vi . spyOn ( mockFixture . getCodexAcpClient ( ) , "logout" ) . mockResolvedValue ( { } ) ;
362377
363378 // @ts -expect-error - exercising private helper
364379 const handled = await codexAcpAgent . availableCommands . handleCommand ( { name : "logout" , input : null } , sessionState ) ;
0 commit comments