Skip to content

Commit 48c15ca

Browse files
committed
Fixing PR build error by resolving typescript issues
1 parent 722c55c commit 48c15ca

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

packages/client/test/client/middleware.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ describe('withCrossAppAccess', () => {
662662
})
663663
);
664664

665-
const callArgs = mockFetch.mock.calls[0];
665+
const callArgs = mockFetch.mock.calls[0]!;
666666
const headers = callArgs[1]?.headers as Headers;
667667
expect(headers.get('Authorization')).toBe('Bearer test-token');
668668
});

packages/client/test/client/xaa-util.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,23 @@ describe('XAA Util', () => {
118118
expect(mockFetch).toHaveBeenCalledTimes(4);
119119

120120
// Verify first call is IDP metadata discovery
121-
const firstCall = mockFetch.mock.calls[0];
121+
const firstCall = mockFetch.mock.calls[0]!;
122122
expect(firstCall[0].toString()).toContain('idp.example.com');
123123

124124
// Verify second call is authorization grant request
125-
const secondCall = mockFetch.mock.calls[1];
125+
const secondCall = mockFetch.mock.calls[1]!;
126126
expect(secondCall[0]).toBe('https://idp.example.com/token');
127127
expect(secondCall[1]?.method).toBe('POST');
128128
expect(secondCall[1]?.headers).toEqual({
129129
'Content-Type': 'application/x-www-form-urlencoded'
130130
});
131131

132132
// Verify third call is MCP metadata discovery
133-
const thirdCall = mockFetch.mock.calls[2];
133+
const thirdCall = mockFetch.mock.calls[2]!;
134134
expect(thirdCall[0].toString()).toContain('auth.example.com');
135135

136136
// Verify fourth call is access token request
137-
const fourthCall = mockFetch.mock.calls[3];
137+
const fourthCall = mockFetch.mock.calls[3]!;
138138
expect(fourthCall[0]).toBe('https://auth.example.com/token');
139139
expect(fourthCall[1]?.method).toBe('POST');
140140
expect(fourthCall[1]?.headers).toEqual({
@@ -709,8 +709,8 @@ describe('XAA Util', () => {
709709

710710
expect(result).toBe('final-access-token');
711711
// Check the token endpoint URL from metadata discovery
712-
expect(mockFetch.mock.calls[1][0]).toContain('https://idp.example.com');
713-
expect(mockFetch.mock.calls[3][0]).toContain('https://auth.example.com');
712+
expect(mockFetch.mock.calls[1]![0]).toContain('https://idp.example.com');
713+
expect(mockFetch.mock.calls[3]![0]).toContain('https://auth.example.com');
714714
});
715715

716716
it('should maintain proper request headers for both calls', async () => {
@@ -744,10 +744,10 @@ describe('XAA Util', () => {
744744
await getAccessToken(xaaOptions, mockFetch);
745745

746746
// Check token request headers (calls 1 and 3, since 0 and 2 are metadata)
747-
expect(mockFetch.mock.calls[1][1]?.headers).toEqual({
747+
expect(mockFetch.mock.calls[1]![1]?.headers).toEqual({
748748
'Content-Type': 'application/x-www-form-urlencoded'
749749
});
750-
expect(mockFetch.mock.calls[3][1]?.headers).toEqual({
750+
expect(mockFetch.mock.calls[3]![1]?.headers).toEqual({
751751
'Content-Type': 'application/x-www-form-urlencoded'
752752
});
753753
});
@@ -783,7 +783,7 @@ describe('XAA Util', () => {
783783
await getAccessToken(xaaOptions, mockFetch);
784784

785785
// Verify first token request includes IDP credentials (call index 1, since 0 is metadata)
786-
const firstBody = mockFetch.mock.calls[1][1]?.body as string;
786+
const firstBody = mockFetch.mock.calls[1]![1]?.body as string;
787787
expect(firstBody).toContain(`grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange`);
788788
expect(firstBody).toContain(`requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aid-jag`);
789789
expect(firstBody).toContain(`audience=${encodeURIComponent(xaaOptions.mcpAuthorisationServerUrl)}`);
@@ -794,7 +794,7 @@ describe('XAA Util', () => {
794794
expect(firstBody).toContain(`client_secret=${encodeURIComponent(xaaOptions.idpClientSecret)}`);
795795

796796
// Verify second token request includes MCP credentials (call index 3, since 2 is metadata)
797-
const secondBody = mockFetch.mock.calls[3][1]?.body as string;
797+
const secondBody = mockFetch.mock.calls[3]![1]?.body as string;
798798
expect(secondBody).toContain(`grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer`);
799799
expect(secondBody).toContain(`assertion=auth-grant-token`);
800800
expect(secondBody).toContain(`scope=${encodeURIComponent(xaaOptions.scope!.join(' '))}`);
@@ -935,7 +935,7 @@ describe('XAA Util', () => {
935935
expect(result).toBe('final-access-token');
936936

937937
// Check that special characters are properly encoded in the first token request body (call index 1)
938-
const firstBody = mockFetch.mock.calls[1][1]?.body as string;
938+
const firstBody = mockFetch.mock.calls[1]![1]?.body as string;
939939
expect(firstBody).toContain(`grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Atoken-exchange`);
940940
expect(firstBody).toContain(`requested_token_type=urn%3Aietf%3Aparams%3Aoauth%3Atoken-type%3Aid-jag`);
941941
expect(firstBody).toContain(`audience=${encodeURIComponent(xaaOptions.mcpAuthorisationServerUrl)}`);
@@ -946,7 +946,7 @@ describe('XAA Util', () => {
946946
expect(firstBody).toContain(`client_secret=secret%40123%21%23%24%25%5E%26%2A%28%29`);
947947

948948
// Check that special characters are properly encoded in the second token request body (call index 3)
949-
const secondBody = mockFetch.mock.calls[3][1]?.body as string;
949+
const secondBody = mockFetch.mock.calls[3]![1]?.body as string;
950950
expect(secondBody).toContain(`grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer`);
951951
expect(secondBody).toContain(`assertion=auth-grant-token`);
952952
expect(secondBody).toContain(`scope=${encodeURIComponent(xaaOptions.scope!.join(' '))}`);

0 commit comments

Comments
 (0)