Skip to content

Commit 1ff08e4

Browse files
committed
Add path test
1 parent 6220701 commit 1ff08e4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/client/auth.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)