Skip to content

Commit 237534d

Browse files
authored
add test for existsFilter when called with parameter
1 parent edac953 commit 237534d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

packages/aws-cdk-lib/aws-sns/test/subscription.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,29 @@ describe('Subscription', () => {
259259
});
260260
});
261261

262+
test.each([true, false])('with %s existsFilter', (existsValue: boolean) => {
263+
// GIVEN
264+
const stack = new cdk.Stack();
265+
const topic = new sns.Topic(stack, 'Topic');
266+
267+
// WHEN
268+
new sns.Subscription(stack, 'Subscription', {
269+
endpoint: 'endpoint',
270+
filterPolicy: {
271+
size: sns.SubscriptionFilter.existsFilter(existsValue),
272+
},
273+
protocol: sns.SubscriptionProtocol.LAMBDA,
274+
topic,
275+
});
276+
277+
// THEN
278+
Template.fromStack(stack).hasResourceProperties('AWS::SNS::Subscription', {
279+
FilterPolicy: {
280+
size: [{ exists: existsValue }],
281+
},
282+
});
283+
});
284+
262285
test('with delivery policy', () => {
263286
// GIVEN
264287
const stack = new cdk.Stack();

0 commit comments

Comments
 (0)