cleanups
This commit is contained in:
parent
ec0c50425e
commit
b16a415623
1 changed files with 25 additions and 52 deletions
|
|
@ -938,8 +938,7 @@ describe("OAuth Authorization", () => {
|
|||
|
||||
// Call the auth function with a resource that has a fragment
|
||||
const result = await auth(mockProvider, {
|
||||
serverUrl: "https://resource.example.com",
|
||||
resource: new URL("https://api.example.com/mcp-server#fragment"),
|
||||
serverUrl: "https://api.example.com/mcp-server#fragment",
|
||||
});
|
||||
|
||||
expect(result).toBe("REDIRECT");
|
||||
|
|
@ -987,8 +986,7 @@ describe("OAuth Authorization", () => {
|
|||
|
||||
// Call auth without authorization code (should trigger redirect)
|
||||
const result = await auth(mockProvider, {
|
||||
serverUrl: "https://resource.example.com",
|
||||
resource: new URL("https://api.example.com/mcp-server"),
|
||||
serverUrl: "https://api.example.com/mcp-server",
|
||||
});
|
||||
|
||||
expect(result).toBe("REDIRECT");
|
||||
|
|
@ -1048,9 +1046,8 @@ describe("OAuth Authorization", () => {
|
|||
|
||||
// Call auth with authorization code
|
||||
const result = await auth(mockProvider, {
|
||||
serverUrl: "https://resource.example.com",
|
||||
serverUrl: "https://api.example.com/mcp-server",
|
||||
authorizationCode: "auth-code-123",
|
||||
resource: new URL("https://api.example.com/mcp-server"),
|
||||
});
|
||||
|
||||
expect(result).toBe("AUTHORIZED");
|
||||
|
|
@ -1111,8 +1108,7 @@ describe("OAuth Authorization", () => {
|
|||
|
||||
// Call auth with existing tokens (should trigger refresh)
|
||||
const result = await auth(mockProvider, {
|
||||
serverUrl: "https://resource.example.com",
|
||||
resource: new URL("https://api.example.com/mcp-server"),
|
||||
serverUrl: "https://api.example.com/mcp-server",
|
||||
});
|
||||
|
||||
expect(result).toBe("AUTHORIZED");
|
||||
|
|
@ -1160,8 +1156,7 @@ describe("OAuth Authorization", () => {
|
|||
|
||||
// Call auth with empty resource parameter
|
||||
const result = await auth(mockProvider, {
|
||||
serverUrl: "https://resource.example.com",
|
||||
resource: undefined,
|
||||
serverUrl: "https://api.example.com/mcp-server",
|
||||
});
|
||||
|
||||
expect(result).toBe("REDIRECT");
|
||||
|
|
@ -1203,8 +1198,7 @@ describe("OAuth Authorization", () => {
|
|||
|
||||
// Call auth with resource containing multiple # symbols
|
||||
const result = await auth(mockProvider, {
|
||||
serverUrl: "https://resource.example.com",
|
||||
resource: new URL("https://api.example.com/mcp-server#fragment#another"),
|
||||
serverUrl: "https://api.example.com/mcp-server#fragment#another",
|
||||
});
|
||||
|
||||
expect(result).toBe("REDIRECT");
|
||||
|
|
@ -1248,8 +1242,7 @@ describe("OAuth Authorization", () => {
|
|||
// This tests the security fix that prevents token confusion between
|
||||
// multiple MCP servers on the same domain
|
||||
const result1 = await auth(mockProvider, {
|
||||
serverUrl: "https://api.example.com",
|
||||
resource: new URL("https://api.example.com/mcp-server-1/v1"),
|
||||
serverUrl: "https://api.example.com/mcp-server-1/v1",
|
||||
});
|
||||
|
||||
expect(result1).toBe("REDIRECT");
|
||||
|
|
@ -1263,8 +1256,7 @@ describe("OAuth Authorization", () => {
|
|||
|
||||
// Test with different path on same domain
|
||||
const result2 = await auth(mockProvider, {
|
||||
serverUrl: "https://api.example.com",
|
||||
resource: new URL("https://api.example.com/mcp-server-2/v1"),
|
||||
serverUrl: "https://api.example.com/mcp-server-2/v1",
|
||||
});
|
||||
|
||||
expect(result2).toBe("REDIRECT");
|
||||
|
|
@ -1308,8 +1300,7 @@ describe("OAuth Authorization", () => {
|
|||
|
||||
// Call auth with resource containing query parameters
|
||||
const result = await auth(mockProvider, {
|
||||
serverUrl: "https://resource.example.com",
|
||||
resource: new URL("https://api.example.com/mcp-server?param=value&another=test"),
|
||||
serverUrl: "https://api.example.com/mcp-server?param=value&another=test",
|
||||
});
|
||||
|
||||
expect(result).toBe("REDIRECT");
|
||||
|
|
|
|||
Loading…
Reference in a new issue