Skip to content

Commit dbb6e4f

Browse files
committed
Add tests
Signed-off-by: Connor Avery <214469360+connoravo-nhs@users.noreply.github.com>
1 parent 15359f9 commit dbb6e4f

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

packages/cdkConstructs/tests/constructs/RestApiGateway.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,41 @@ describe("RestApiGateway with mTLS", () => {
344344
})
345345
})
346346

347+
describe("RestApiGateway with mTLS and stackUUID", () => {
348+
test("uses stackUUID in trust store deployment key prefix", () => {
349+
const app = new App()
350+
const stack = new Stack(app, "RestApiGatewayStackWithUuid")
351+
352+
const testPolicy = new ManagedPolicy(stack, "TestPolicy", {
353+
description: "test execution policy",
354+
statements: [
355+
new PolicyStatement({
356+
actions: ["lambda:InvokeFunction"],
357+
resources: ["arn:aws:lambda:eu-west-2:123456789012:function:test-function"]
358+
})
359+
]
360+
})
361+
362+
const apiGateway = new RestApiGateway(stack, "TestApiGateway", {
363+
stackName: "test-stack",
364+
stackUUID: "f47ac10b",
365+
logRetentionInDays: 30,
366+
mutualTlsTrustStoreKey: "truststore.pem",
367+
forwardCsocLogs: false,
368+
csocApiGatewayDestination: "",
369+
executionPolicies: [testPolicy],
370+
enableServiceDomain: true
371+
})
372+
373+
apiGateway.api.root.addMethod("GET")
374+
375+
const template = Template.fromStack(stack)
376+
template.hasResourceProperties("Custom::CDKBucketDeployment", {
377+
DestinationKeyPrefix: "cpt-api/test-stack-f47ac10b-truststore"
378+
})
379+
})
380+
})
381+
347382
describe("RestApiGateway validation errors", () => {
348383
test("throws when forwardCsocLogs is true and csocApiGatewayDestination is empty string", () => {
349384
const app = new App()

0 commit comments

Comments
 (0)