Skip to content

Commit 191e08b

Browse files
committed
test(layers): add parser to layber publisher e2e test
1 parent c2eaac0 commit 191e08b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

layers/tests/e2e/layerPublisher.class.test.functionCode.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import { AppConfigProvider } from '@aws-lambda-powertools/parameters/appconfig';
88
import { DynamoDBProvider } from '@aws-lambda-powertools/parameters/dynamodb';
99
import { SecretsProvider } from '@aws-lambda-powertools/parameters/secrets';
1010
import { SSMProvider } from '@aws-lambda-powertools/parameters/ssm';
11+
import { CloudFormationCustomResourceCreateSchema } from '@aws-lambda-powertools/parser/schemas';
1112
import { Tracer } from '@aws-lambda-powertools/tracer';
1213
import { AppConfigDataClient } from '@aws-sdk/client-appconfigdata';
1314
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
1415
import { SecretsManagerClient } from '@aws-sdk/client-secrets-manager';
1516
import { SSMClient } from '@aws-sdk/client-ssm';
17+
import type { CloudFormationCustomResourceCreateEvent } from 'aws-lambda';
1618

1719
const logger = new Logger({
1820
logLevel: 'DEBUG',
@@ -79,7 +81,9 @@ const getVersionFromModule = async (moduleName: string): Promise<string> => {
7981
return moduleVersion;
8082
};
8183

82-
export const handler = async (): Promise<void> => {
84+
export const handler = async (
85+
event: CloudFormationCustomResourceCreateEvent
86+
): Promise<void> => {
8387
// Check that the packages version matches the expected one
8488
for (const moduleName of [
8589
'commons',
@@ -89,6 +93,7 @@ export const handler = async (): Promise<void> => {
8993
'parameters',
9094
'idempotency',
9195
'batch',
96+
'parser',
9297
]) {
9398
const moduleVersion = await getVersionFromModule(moduleName);
9499
if (moduleVersion !== expectedVersion) {
@@ -115,4 +120,7 @@ export const handler = async (): Promise<void> => {
115120
// the presence of a log will indicate that the logger is working
116121
// while the content of the log will indicate that the tracer is working
117122
logger.debug('subsegment', { subsegment: subsegment.format() });
123+
124+
// Check that the parser is working
125+
CloudFormationCustomResourceCreateSchema.parse(event);
118126
};

0 commit comments

Comments
 (0)