Skip to content

Commit 185951c

Browse files
authoredMay 29, 2019
fix(s3): move notification destinations into their own module (#2659)
In accordance with new guidelines, we're centralizing cross-service integrations into their own package. In this case, centralizing S3 Notification Destinations into `@aws-cdk/aws-s3-notifications`. Fixes #2445. BREAKING CHANGE: using a Topic, Queue or Lambda as bucket notification destination now requires an integration object from the `@aws-cdk/aws-s3-notifications` package.
1 parent d640055 commit 185951c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+6224
-893
lines changed
 

‎packages/@aws-cdk/assert/jest.ts

+25
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import { Stack } from "@aws-cdk/cdk";
22
import { SynthesizedStack } from "@aws-cdk/cx-api";
33
import { HaveResourceAssertion, ResourcePart } from "./lib/assertions/have-resource";
4+
import { MatchStyle, matchTemplate } from "./lib/assertions/match-template";
45
import { expect as ourExpect } from './lib/expect';
56

67
declare global {
78
namespace jest {
89
interface Matchers<R> {
10+
toMatchTemplate(template: any,
11+
matchStyle?: MatchStyle): R;
12+
913
toHaveResource(resourceType: string,
1014
properties?: any,
1115
comparison?: ResourcePart): R;
@@ -18,6 +22,27 @@ declare global {
1822
}
1923

2024
expect.extend({
25+
toMatchTemplate(
26+
actual: SynthesizedStack | Stack,
27+
template: any,
28+
matchStyle?: MatchStyle) {
29+
30+
const assertion = matchTemplate(template, matchStyle);
31+
const inspector = ourExpect(actual);
32+
const pass = assertion.assertUsing(inspector);
33+
if (pass) {
34+
return {
35+
pass,
36+
message: () => `Not ` + assertion.description
37+
};
38+
} else {
39+
return {
40+
pass,
41+
message: () => assertion.description
42+
};
43+
}
44+
},
45+
2146
toHaveResource(
2247
actual: SynthesizedStack | Stack,
2348
resourceType: string,

‎packages/@aws-cdk/assert/lib/synth-utils.ts

+20
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,24 @@ export class SynthUtils {
1414
const synth = new Synthesizer();
1515
return synth.synthesize(stack, options);
1616
}
17+
18+
public static subset(stack: Stack, options: SubsetOptions): any {
19+
const template = SynthUtils.toCloudFormation(stack);
20+
if (template.Resources) {
21+
for (const [key, resource] of Object.entries(template.Resources)) {
22+
if (options.resourceTypes && !options.resourceTypes.includes((resource as any).Type)) {
23+
delete template.Resources[key];
24+
}
25+
}
26+
}
27+
28+
return template;
29+
}
30+
}
31+
32+
export interface SubsetOptions {
33+
/**
34+
* Match all resources of the given type
35+
*/
36+
resourceTypes?: string[];
1737
}

0 commit comments

Comments
 (0)