@@ -79,7 +79,58 @@ const validConfig: DiscoveryConfig = {
7979 lafsVersion : "1.0.0"
8080} ;
8181
82+ const validAgentConfig : DiscoveryConfig = {
83+ agent : {
84+ name : "test-agent" ,
85+ description : "A2A test agent" ,
86+ version : "1.0.0" ,
87+ url : "https://example.com/api/v1/envelope" ,
88+ capabilities : {
89+ streaming : true ,
90+ pushNotifications : false ,
91+ extensions : [ ] ,
92+ } ,
93+ defaultInputModes : [ "application/json" ] ,
94+ defaultOutputModes : [ "application/json" ] ,
95+ skills : [
96+ {
97+ id : "envelope-processor" ,
98+ name : "Envelope Processor" ,
99+ description : "Process LAFS envelopes" ,
100+ tags : [ "process" , "validate" ] ,
101+ } ,
102+ ] ,
103+ } ,
104+ cacheMaxAge : 3600 ,
105+ } ;
106+
82107describe ( "Discovery Middleware" , ( ) => {
108+ describe ( "GET /.well-known/agent-card.json" , ( ) => {
109+ it ( "should return A2A agent card as primary discovery document" , async ( ) => {
110+ const app = createApp ( validAgentConfig ) ;
111+ const response = await request ( app )
112+ . get ( "/.well-known/agent-card.json" )
113+ . expect ( 200 )
114+ . expect ( "Content-Type" , / j s o n / ) ;
115+
116+ expect ( response . body . name ) . toBe ( "test-agent" ) ;
117+ expect ( response . body . capabilities ) . toBeDefined ( ) ;
118+ expect ( response . body . skills ) . toBeDefined ( ) ;
119+ expect ( response . body . defaultInputModes ) . toContain ( "application/json" ) ;
120+ expect ( response . body . defaultOutputModes ) . toContain ( "application/json" ) ;
121+ } ) ;
122+
123+ it ( "should not include legacy deprecation headers on primary path" , async ( ) => {
124+ const app = createApp ( validAgentConfig ) ;
125+ const response = await request ( app )
126+ . get ( "/.well-known/agent-card.json" )
127+ . expect ( 200 ) ;
128+
129+ expect ( response . headers . deprecation ) . toBeUndefined ( ) ;
130+ expect ( response . headers . sunset ) . toBeUndefined ( ) ;
131+ } ) ;
132+ } ) ;
133+
83134 describe ( "GET /.well-known/lafs.json" , ( ) => {
84135 it ( "should return valid JSON" , async ( ) => {
85136 const app = createApp ( validConfig ) ;
0 commit comments