Skip to content

Commit 10959c2

Browse files
committed
test: add test for OIDC config
1 parent 678b3e3 commit 10959c2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/client/auth.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,20 @@ describe("OAuth Authorization", () => {
206206
});
207207
});
208208

209+
it("returns metadata when discovery succeeds", async () => {
210+
mockFetch.mockResolvedValueOnce({
211+
ok: true,
212+
status: 200,
213+
json: async () => validMetadata,
214+
});
215+
216+
await discoverOAuthMetadata("https://auth.example.com", {useOidcConfig: true});
217+
const calls = mockFetch.mock.calls;
218+
expect(calls.length).toBe(1);
219+
const [url] = calls[0];
220+
expect(url.toString()).toBe("https://auth.example.com/.well-known/openid-configuration");
221+
});
222+
209223
it("returns metadata when first fetch fails but second without MCP header succeeds", async () => {
210224
// Set up a counter to control behavior
211225
let callCount = 0;

0 commit comments

Comments
 (0)