-
Notifications
You must be signed in to change notification settings - Fork 153
/
Copy pathlayer-publisher.test.ts
49 lines (43 loc) · 1.51 KB
/
layer-publisher.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* Test LayerPublisherStack class
*
* @group unit/layers/all
*/
import { App } from 'aws-cdk-lib';
import { Template } from 'aws-cdk-lib/assertions';
import { LayerPublisherStack } from '../../src/layer-publisher-stack';
describe('Class: LayerPublisherStack', () => {
it('creates the stack with a layer in it', () => {
// Prepare
const app = new App();
const stack = new LayerPublisherStack(app, 'MyTestStack', {
layerName: 'AWSLambdaPowertoolsTypeScript',
powertoolsPackageVersion: '1.0.1',
buildFromLocal: true,
ssmParameterLayerArn: '/layers/powertools-layer-arn',
});
// Act
const template = Template.fromStack(stack);
// Assess
template.resourceCountIs('AWS::Lambda::LayerVersion', 1);
template.hasResourceProperties('AWS::Lambda::LayerVersion', {
CompatibleRuntimes: ['nodejs16.x', 'nodejs18.x', 'nodejs20.x'],
LicenseInfo: 'MIT-0',
/* CompatibleArchitectures: [
'x86_64',
], */
Description: 'Powertools for AWS Lambda (TypeScript) version 1.0.1',
LayerName: 'AWSLambdaPowertoolsTypeScript',
});
template.resourceCountIs('AWS::Lambda::LayerVersionPermission', 1);
template.hasResourceProperties('AWS::Lambda::LayerVersionPermission', {
Action: 'lambda:GetLayerVersion',
Principal: '*',
});
template.resourceCountIs('AWS::SSM::Parameter', 1);
template.hasResourceProperties('AWS::SSM::Parameter', {
Name: '/layers/powertools-layer-arn',
Type: 'String',
});
});
});