-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(assertions): findXxx() APIs now includes the logical id as part …
…of its result (#16454) The current return type of `findResources()`, `findOutputs()`, and `findMappings()` omits the `logicalId`. This creates ambiguity because it is not trivial to figure out which resource/output/mapping is being matched. For example, ```ts const result = assert.findOutputs('*', { Value: 'Fred', }); ``` Could return a list like: ```ts expect(result).toEqual([ { Value: 'Fred', Description: 'FooFred' }, { Value: 'Fred', Description: 'BarFred' }, ]); ``` This does not provide information on which output(s) are being matched to the `Value: 'Fred'` property. Under the new return type proposed in this PR, the output would look like this: ```ts expect(result).toEqual({ Foo: { Value: 'Fred', Description: 'FooFred' }, Bar: { Value: 'Fred', Description: 'BarFred' }, }); ``` Returning the `logicalId` in this way for all `find*()` APIs will provide the full picture back to the user. BREAKING CHANGE: the `findResources()` API previously returned a list of resources, but now returns a map of logical id to resource. * **assertions:** the `findOutputs()` API previously returned a list of outputs, but now returns a map of logical id to output. * **assertions:** the `findMappings()` API previously returned a list of mappings, but now returns a map of logical id to mapping. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
10 changed files
with
70 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters