Skip to content

Commit 73cb111

Browse files
committed
Update tests
1 parent 31b148b commit 73cb111

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

tests/adapter.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ vi.mock('@pulumi/pulumi/automation/index.js', () => {
2020
up: vi.fn(() => {
2121
return {
2222
outputs: {
23+
serverArn: {
24+
value: 'mock',
25+
},
26+
optionsArn: {
27+
value: 'mock',
28+
},
2329
serverDomain: {
2430
value: 'mock',
2531
},

tests/stacks.main.resources.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ describe('stacks/main/resources.ts', () => {
2020
it('getLambdaRole', async () => {
2121
const test = infra.getLambdaRole()
2222
const assumeRolePolicy = await promiseOf(test.assumeRolePolicy)
23-
const statement = JSON.parse(assumeRolePolicy).Statement[0]
23+
const statement = JSON.parse(assumeRolePolicy).statements[0]
2424

2525
expectTypeOf(test).toEqualTypeOf<aws.iam.Role>()
26-
expect(statement.Action).toMatch('sts:AssumeRole')
27-
expect(statement.Effect).toMatch('Allow')
28-
expect(statement.Principal.Service).toMatch('lambda.amazonaws.com')
26+
expect(statement.actions[0]).toMatch('sts:AssumeRole')
27+
expect(statement.effect).toMatch('Allow')
28+
expect(statement.principals[0].identifiers).toEqual([
29+
'lambda.amazonaws.com',
30+
'edgelambda.amazonaws.com',
31+
])
2932
})
3033

3134
it('validateCertificate-Wrong-Domain', async () => {
@@ -118,7 +121,6 @@ describe('stacks/main/resources.ts', () => {
118121
// Need to wait for the mocks to update
119122
await new Promise((r) => setTimeout(r, 100))
120123

121-
console.log(Object.keys(mocks.resources))
122124
expect(Object.keys(mocks.resources)).toHaveLength(2)
123125
const resource = Object.values(mocks.resources)[0]
124126

@@ -173,7 +175,7 @@ describe('stacks/main/resources.ts', () => {
173175
'aws:cloudfront/originAccessControl:OriginAccessControl'
174176
)
175177
expect(oac.originAccessControlOriginType).toMatch('s3')
176-
expect(oac.signingBehavior).toMatch('always')
178+
expect(oac.signingBehavior).toMatch('no-override')
177179
expect(oac.signingProtocol).toMatch('sigv4')
178180

179181
const distAliases = await promiseOf(distribution.aliases)

tests/stacks.server.resources.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('stacks/server/resources.ts', () => {
4545
const authorizationType = await promiseOf(functionURL.authorizationType)
4646

4747
expectTypeOf(functionURL).toEqualTypeOf<aws.lambda.FunctionUrl>()
48-
expect(authorizationType).toMatch('NONE')
48+
expect(authorizationType).toMatch('AWS_IAM')
4949

5050
const lambdaMatch = functionName.match('(.*?)-arn')
5151
const lambdaIntegrationName = lambdaMatch![1]

0 commit comments

Comments
 (0)