Skip to content

Commit 9fdedb1

Browse files
jesseturner21claude
andcommitted
fix(tests): update tests for optional OAuth discoveryUrl schema change
OAuthCredentialProvider.discoveryUrl was made optional to support imported providers that already exist in Identity service. Update tests to match: - Schema test: expect success when discoveryUrl is omitted - Pre-deploy identity tests: add discoveryUrl to fixtures that test update and error paths (without it, the code now skips the provider) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c46f4a4 commit 9fdedb1

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

src/cli/operations/deploy/__tests__/pre-deploy-identity.test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,13 @@ describe('setupOAuth2Providers', () => {
322322
mockUpdateOAuth2Provider.mockResolvedValue({ success: true, result: {} });
323323

324324
const projectSpec = {
325-
credentials: [{ name: 'test-oauth', type: 'OAuthCredentialProvider' }],
325+
credentials: [
326+
{
327+
name: 'test-oauth',
328+
type: 'OAuthCredentialProvider',
329+
discoveryUrl: 'https://accounts.google.com/.well-known/openid_configuration',
330+
},
331+
],
326332
};
327333

328334
const result = await setupOAuth2Providers({
@@ -365,7 +371,13 @@ describe('setupOAuth2Providers', () => {
365371
mockCreateOAuth2Provider.mockResolvedValue({ success: false, error: 'Creation failed' });
366372

367373
const projectSpec = {
368-
credentials: [{ name: 'test-oauth', type: 'OAuthCredentialProvider' }],
374+
credentials: [
375+
{
376+
name: 'test-oauth',
377+
type: 'OAuthCredentialProvider',
378+
discoveryUrl: 'https://accounts.google.com/.well-known/openid_configuration',
379+
},
380+
],
369381
};
370382

371383
const result = await setupOAuth2Providers({

src/schema/schemas/__tests__/agentcore-project.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,12 @@ describe('CredentialSchema', () => {
290290
expect(result.success).toBe(true);
291291
});
292292

293-
it('OAuthCredentialProvider without discoveryUrl fails', () => {
293+
it('OAuthCredentialProvider without discoveryUrl succeeds (optional for imported providers)', () => {
294294
const result = CredentialSchema.safeParse({
295295
type: 'OAuthCredentialProvider',
296296
name: 'MyOAuth',
297297
});
298-
expect(result.success).toBe(false);
298+
expect(result.success).toBe(true);
299299
});
300300

301301
it('invalid type fails discriminated union', () => {

0 commit comments

Comments
 (0)