@@ -1370,109 +1370,37 @@ describe('stack', () => {
1370
1370
1371
1371
// THEN - producers are the same
1372
1372
expect ( ( ) => {
1373
- resourceM . overrideLogicalId ( 'OVERRIDELOGICALID ' ) ;
1373
+ resourceM . overrideLogicalId ( 'OVERRIDE_LOGICAL_ID ' ) ;
1374
1374
} ) . toThrow ( / T h e l o g i c a l I d f o r r e s o u r c e a t p a t h P r o d u c e r \/ R e s o u r c e X X X h a s b e e n l o c k e d a n d c a n n o t b e o v e r r i d d e n / ) ;
1375
1375
} ) ;
1376
1376
1377
- test ( 'throw error if overrideLogicalId contains non-alphanumeric characters' , ( ) => {
1378
- // GIVEN: manual
1379
- const appM = new App ( ) ;
1380
- const producerM = new Stack ( appM , 'Producer' ) ;
1381
- const resourceM = new CfnResource ( producerM , 'ResourceXXX' , { type : 'AWS::Resource' } ) ;
1382
-
1383
- // THEN - producers are the same
1384
- expect ( ( ) => {
1385
- resourceM . overrideLogicalId ( 'INVALID_LOGICAL_ID' ) ;
1386
- } ) . toThrow ( / m u s t o n l y c o n t a i n a l p h a n u m e r i c c h a r a c t e r s / ) ;
1387
- } ) ;
1388
-
1389
- test ( 'throw error if overrideLogicalId is over 255 characters' , ( ) => {
1390
- // GIVEN: manual
1391
- const appM = new App ( ) ;
1392
- const producerM = new Stack ( appM , 'Producer' ) ;
1393
- const resourceM = new CfnResource ( producerM , 'ResourceXXX' , { type : 'AWS::Resource' } ) ;
1394
-
1395
- // THEN - producers are the same
1396
- expect ( ( ) => {
1397
- resourceM . overrideLogicalId (
1398
- // 256 character long string of "aaaa..."
1399
- Array ( 256 ) . fill ( 'a' ) . join ( '' ) ,
1400
- ) ;
1401
- } ) . toThrow ( / m u s t b e a t m o s t 2 5 5 c h a r a c t e r s l o n g , g o t 2 5 6 c h a r a c t e r s / ) ;
1402
- } ) ;
1403
-
1404
- test ( 'throw error if overrideLogicalId is an empty string' , ( ) => {
1405
- // GIVEN: manual
1406
- const appM = new App ( ) ;
1407
- const producerM = new Stack ( appM , 'Producer' ) ;
1408
- const resourceM = new CfnResource ( producerM , 'ResourceXXX' , { type : 'AWS::Resource' } ) ;
1409
-
1410
- // THEN - producers are the same
1411
- expect ( ( ) => {
1412
- resourceM . overrideLogicalId ( '' ) ;
1413
- } ) . toThrow ( 'Cannot set an empty logical ID' ) ;
1414
- } ) ;
1415
-
1416
1377
test ( 'do not throw error if overrideLogicalId is used and logicalId is not locked' , ( ) => {
1417
1378
// GIVEN: manual
1418
1379
const appM = new App ( ) ;
1419
1380
const producerM = new Stack ( appM , 'Producer' ) ;
1420
1381
const resourceM = new CfnResource ( producerM , 'ResourceXXX' , { type : 'AWS::Resource' } ) ;
1421
1382
1422
1383
// THEN - producers are the same
1423
- resourceM . overrideLogicalId ( 'OVERRIDELOGICALID' ) ;
1424
- producerM . exportValue ( resourceM . getAtt ( 'Att' ) ) ;
1425
-
1426
- const template = appM . synth ( ) . getStackByName ( producerM . stackName ) . template ;
1427
- expect ( template ) . toMatchObject ( {
1428
- Outputs : {
1429
- ExportsOutputFnGetAttOVERRIDELOGICALIDAtt76AC816F : {
1430
- Export : {
1431
- Name : 'Producer:ExportsOutputFnGetAttOVERRIDELOGICALIDAtt76AC816F' ,
1432
- } ,
1433
- Value : {
1434
- 'Fn::GetAtt' : [
1435
- 'OVERRIDELOGICALID' ,
1436
- 'Att' ,
1437
- ] ,
1438
- } ,
1439
- } ,
1440
- } ,
1441
- Resources : {
1442
- OVERRIDELOGICALID : {
1443
- Type : 'AWS::Resource' ,
1444
- } ,
1445
- } ,
1446
- } ) ;
1447
- } ) ;
1448
-
1449
- test ( 'do not throw if overrideLogicalId is unresolved' , ( ) => {
1450
- // GIVEN: manual
1451
- const appM = new App ( ) ;
1452
- const producerM = new Stack ( appM , 'Producer' ) ;
1453
- const resourceM = new CfnResource ( producerM , 'ResourceXXX' , { type : 'AWS::Resource' } ) ;
1454
-
1455
- // THEN - producers are the same
1456
- resourceM . overrideLogicalId ( Lazy . string ( { produce : ( ) => 'INVALID_LOGICAL_ID' } ) ) ;
1384
+ resourceM . overrideLogicalId ( 'OVERRIDE_LOGICAL_ID' ) ;
1457
1385
producerM . exportValue ( resourceM . getAtt ( 'Att' ) ) ;
1458
1386
1459
1387
const template = appM . synth ( ) . getStackByName ( producerM . stackName ) . template ;
1460
1388
expect ( template ) . toMatchObject ( {
1461
1389
Outputs : {
1462
- ExportsOutputFnGetAttINVALIDLOGICALIDAtt6CB9E5B9 : {
1390
+ ExportsOutputFnGetAttOVERRIDELOGICALIDAtt2DD28019 : {
1463
1391
Export : {
1464
- Name : 'Producer:ExportsOutputFnGetAttINVALIDLOGICALIDAtt6CB9E5B9 ' ,
1392
+ Name : 'Producer:ExportsOutputFnGetAttOVERRIDELOGICALIDAtt2DD28019 ' ,
1465
1393
} ,
1466
1394
Value : {
1467
1395
'Fn::GetAtt' : [
1468
- 'INVALID_LOGICAL_ID ' ,
1396
+ 'OVERRIDE_LOGICAL_ID ' ,
1469
1397
'Att' ,
1470
1398
] ,
1471
1399
} ,
1472
1400
} ,
1473
1401
} ,
1474
1402
Resources : {
1475
- INVALID_LOGICAL_ID : {
1403
+ OVERRIDE_LOGICAL_ID : {
1476
1404
Type : 'AWS::Resource' ,
1477
1405
} ,
1478
1406
} ,
0 commit comments