Skip to content

Commit

Permalink
test: add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
badmintoncryer committed Jan 28, 2024
1 parent 0251833 commit 6ec6ff7
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/aws-cdk-lib/aws-ec2/test/vpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,38 @@ describe('vpc', () => {

Template.fromStack(stack).resourceCountIs('Custom::VpcRestrictDefaultSG', 0);
});

test.each(
[
{
subnetType: SubnetType.PRIVATE_ISOLATED,
},
{
subnetType: SubnetType.PRIVATE_WITH_EGRESS,
additionalSubnetConfig: [{ subnetType: SubnetType.PUBLIC, name: 'public' }],
},
{
subnetType: SubnetType.PUBLIC,
},
],
)('subnet has dependent on the CIDR block when ipv6AssignAddressOnCreation is set to true, ', (testData) => {
const stack = getTestStack();
new Vpc(stack, 'TheVPC', {
ipProtocol: IpProtocol.DUAL_STACK,
maxAzs: 1,
subnetConfiguration: [
{
subnetType: testData.subnetType,
name: 'subnetName',
ipv6AssignAddressOnCreation: true,
},
...testData.additionalSubnetConfig ?? [],
],
});
Template.fromStack(stack).hasResource('AWS::EC2::Subnet', {
DependsOn: ['TheVPCipv6cidrF3E84E30'],
});
});
});

describe('fromVpcAttributes', () => {
Expand Down

0 comments on commit 6ec6ff7

Please sign in to comment.