Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8d9d94c

Browse files
committedMar 22, 2025·
getDummyObject to getDummyObjects
fix test
1 parent 407cdb2 commit 8d9d94c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed
 

‎packages/aws-cdk/lib/context-providers/cc-api-provider.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export class CcApiContextProviderPlugin implements ContextProviderPlugin {
2525
return result;
2626
} catch (err) {
2727
if (err instanceof ResourceNotFoundException) {
28-
const dummyObject = this.getDummyObject(args);
29-
if (dummyObject) {
30-
return dummyObject;
28+
const dummyObjects = this.getDummyObjects(args);
29+
if (dummyObjects) {
30+
return dummyObjects;
3131
}
3232
}
3333
throw err;
@@ -144,9 +144,9 @@ export class CcApiContextProviderPlugin implements ContextProviderPlugin {
144144
return resultObjs;
145145
}
146146

147-
private getDummyObject(args: CcApiContextQuery): {[key: string]: any}[] {
147+
private getDummyObjects(args: CcApiContextQuery): {[key: string]: any}[] {
148148
if (!Array.isArray(args.dummyValue) || args.dummyValue.length === 0 || !args.dummyValue.every(value => typeof value === 'object' && value !== null)) {
149-
throw new ContextProviderError(`dummyValue must be an array of objects. Failed to get dummy object for type ${args.typeName}.`);
149+
throw new ContextProviderError(`dummyValue must be an array of objects. Failed to get dummy objects for type ${args.typeName}.`);
150150
}
151151

152152
return args.dummyValue.map((dummyValue) =>

‎packages/aws-cdk/test/context-providers/cc-api-provider.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ describe('dummy value', () => {
405405
propertiesToReturn: ['DBInstanceArn', 'StorageEncrypted'],
406406
ignoreFailedLookup: true,
407407
}),
408-
).rejects.toThrow('dummyValue must be an array of objects. Failed to get dummy object for type AWS::RDS::DBInstance.');
408+
).rejects.toThrow('dummyValue must be an array of objects. Failed to get dummy objects for type AWS::RDS::DBInstance.');
409409
});
410410

411411
test('throws error when CC API fails and dummyValue is not an array', async () => {
@@ -426,7 +426,7 @@ describe('dummy value', () => {
426426
StorageEncrypted: 'true',
427427
},
428428
}),
429-
).rejects.toThrow('dummyValue must be an array of objects. Failed to get dummy object for type AWS::RDS::DBInstance.');
429+
).rejects.toThrow('dummyValue must be an array of objects. Failed to get dummy objects for type AWS::RDS::DBInstance.');
430430
});
431431

432432
test('throws error when CC API fails and dummyValue is an empty array', async () => {
@@ -444,7 +444,7 @@ describe('dummy value', () => {
444444
ignoreFailedLookup: true,
445445
dummyValue: [],
446446
}),
447-
).rejects.toThrow('dummyValue must be an array of objects. Failed to get dummy object for type AWS::RDS::DBInstance.');
447+
).rejects.toThrow('dummyValue must be an array of objects. Failed to get dummy objects for type AWS::RDS::DBInstance.');
448448
});
449449

450450
test('throws error when CC API fails and dummyValue is not an object array', async () => {
@@ -464,7 +464,7 @@ describe('dummy value', () => {
464464
'not an object',
465465
],
466466
}),
467-
).rejects.toThrow('dummyValue must be an array of objects. Failed to get dummy object for type AWS::RDS::DBInstance.');
467+
).rejects.toThrow('dummyValue must be an array of objects. Failed to get dummy objects for type AWS::RDS::DBInstance.');
468468
});
469469
});
470470
/* eslint-enable */

0 commit comments

Comments
 (0)
Please sign in to comment.