11import { describe , expect , it } from 'vitest' ;
22import { ConsoleFunction } from '../../src' ;
33import { compileTestStack } from '../helper' ;
4+ import { cx_api } from 'aws-cdk-lib' ;
45import { Architecture } from 'aws-cdk-lib/aws-lambda' ;
56import { mapValues } from 'lodash' ;
67
@@ -19,6 +20,20 @@ describe('ConsoleFunction', () => {
1920 expect ( layers [ 1 ] ) . to . match ( / a r n : a w s : l a m b d a : u s - e a s t - 1 : 5 3 4 0 8 1 3 0 6 6 0 3 : l a y e r : c o n s o l e : \d + / ) ;
2021 } ) ;
2122
23+ it ( 'adds the console layer with recognizeLayerVersion flag' , ( ) => {
24+ const template = compileTestStack ( ( stack ) => {
25+ new ConsoleFunction ( stack , 'Console' , {
26+ handler : 'index.php' ,
27+ } ) ;
28+ } , { context : { [ cx_api . LAMBDA_RECOGNIZE_LAYER_VERSION ] : true } } ) ;
29+
30+ const consoleFunction = template . findResources ( 'AWS::Lambda::Function' ) ;
31+ const layers = consoleFunction . Console63CA37A7 . Properties . Layers ;
32+ expect ( layers ) . length ( 2 ) ;
33+ expect ( layers [ 0 ] ) . to . match ( / a r n : a w s : l a m b d a : u s - e a s t - 1 : 5 3 4 0 8 1 3 0 6 6 0 3 : l a y e r : p h p - 8 1 : \d + / ) ;
34+ expect ( layers [ 1 ] ) . to . match ( / a r n : a w s : l a m b d a : u s - e a s t - 1 : 5 3 4 0 8 1 3 0 6 6 0 3 : l a y e r : c o n s o l e : \d + / ) ;
35+ } ) ;
36+
2237 it ( 'supports ARM' , ( ) => {
2338 const template = compileTestStack ( ( stack ) => {
2439 new ConsoleFunction ( stack , 'Console' , {
0 commit comments