File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,24 @@ describe("OAuth Authorization", () => {
207207 } ) ;
208208 } ) ;
209209
210+ it ( "returns metadata when discovery succeeds with path" , async ( ) => {
211+ mockFetch . mockResolvedValueOnce ( {
212+ ok : true ,
213+ status : 200 ,
214+ json : async ( ) => validMetadata ,
215+ } ) ;
216+
217+ const metadata = await discoverOAuthMetadata ( "https://auth.example.com/path/name" ) ;
218+ expect ( metadata ) . toEqual ( validMetadata ) ;
219+ const calls = mockFetch . mock . calls ;
220+ expect ( calls . length ) . toBe ( 1 ) ;
221+ const [ url , options ] = calls [ 0 ] ;
222+ expect ( url . toString ( ) ) . toBe ( "https://auth.example.com/.well-known/oauth-authorization-server/path/name" ) ;
223+ expect ( options . headers ) . toEqual ( {
224+ "MCP-Protocol-Version" : LATEST_PROTOCOL_VERSION
225+ } ) ;
226+ } ) ;
227+
210228 it ( "returns metadata when first fetch fails but second without MCP header succeeds" , async ( ) => {
211229 // Set up a counter to control behavior
212230 let callCount = 0 ;
You can’t perform that action at this time.
0 commit comments