You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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*
0 commit comments