1
- import '@aws-cdk/assert-internal/jest' ;
2
- import { ABSENT } from '@aws-cdk/assert-internal' ;
1
+ import { Match , Template } from '@aws-cdk/assertions' ;
3
2
import * as cdk from '@aws-cdk/core' ;
4
3
import * as appmesh from '../lib' ;
5
4
@@ -50,9 +49,9 @@ describe('gateway route', () => {
50
49
} ) ;
51
50
52
51
// THEN
53
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
52
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
54
53
GatewayRouteName : 'gateway-http-route' ,
55
- MeshOwner : ABSENT ,
54
+ MeshOwner : Match . absent ( ) ,
56
55
Spec : {
57
56
HttpRoute : {
58
57
Action : {
@@ -70,7 +69,7 @@ describe('gateway route', () => {
70
69
} ,
71
70
} ,
72
71
} ) ;
73
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
72
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
74
73
GatewayRouteName : 'gateway-http2-route' ,
75
74
Spec : {
76
75
Http2Route : {
@@ -89,7 +88,7 @@ describe('gateway route', () => {
89
88
} ,
90
89
} ,
91
90
} ) ;
92
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
91
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
93
92
GatewayRouteName : 'gateway-grpc-route' ,
94
93
Spec : {
95
94
GrpcRoute : {
@@ -163,11 +162,9 @@ describe('gateway route', () => {
163
162
} ) ;
164
163
165
164
// THEN
166
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
165
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
167
166
MeshOwner : meshEnv . account ,
168
167
} ) ;
169
-
170
-
171
168
} ) ;
172
169
} ) ;
173
170
@@ -214,7 +211,7 @@ describe('gateway route', () => {
214
211
} ) ;
215
212
216
213
// THEN
217
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
214
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
218
215
GatewayRouteName : 'gateway-http-route' ,
219
216
Spec : {
220
217
HttpRoute : {
@@ -229,7 +226,7 @@ describe('gateway route', () => {
229
226
} ,
230
227
} ) ;
231
228
232
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
229
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
233
230
GatewayRouteName : 'gateway-grpc-route' ,
234
231
Spec : {
235
232
GrpcRoute : {
@@ -243,8 +240,6 @@ describe('gateway route', () => {
243
240
} ,
244
241
} ,
245
242
} ) ;
246
-
247
-
248
243
} ) ;
249
244
} ) ;
250
245
@@ -279,10 +274,8 @@ describe('gateway route', () => {
279
274
} ) ,
280
275
gatewayRouteName : 'gateway-http2-route' ,
281
276
} ) ;
282
-
283
-
284
277
// THEN
285
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
278
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
286
279
GatewayRouteName : 'gateway-http2-route' ,
287
280
Spec : {
288
281
Http2Route : {
@@ -296,8 +289,6 @@ describe('gateway route', () => {
296
289
} ,
297
290
} ,
298
291
} ) ;
299
-
300
-
301
292
} ) ;
302
293
} ) ;
303
294
@@ -355,7 +346,7 @@ describe('gateway route', () => {
355
346
} ) ;
356
347
357
348
// THEN
358
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
349
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
359
350
GatewayRouteName : 'gateway-http-route' ,
360
351
Spec : {
361
352
HttpRoute : {
@@ -370,7 +361,7 @@ describe('gateway route', () => {
370
361
} ,
371
362
} ) ;
372
363
373
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
364
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
374
365
GatewayRouteName : 'gateway-http2-route' ,
375
366
Spec : {
376
367
Http2Route : {
@@ -385,18 +376,16 @@ describe('gateway route', () => {
385
376
} ,
386
377
} ) ;
387
378
388
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
379
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
389
380
GatewayRouteName : 'gateway-http2-route-1' ,
390
381
Spec : {
391
382
Http2Route : {
392
383
Action : {
393
- Rewrite : ABSENT ,
384
+ Rewrite : Match . absent ( ) ,
394
385
} ,
395
386
} ,
396
387
} ,
397
388
} ) ;
398
-
399
-
400
389
} ) ;
401
390
402
391
test ( "should throw an error if the prefix match does not start and end with '/'" , ( ) => {
@@ -429,8 +418,6 @@ describe('gateway route', () => {
429
418
gatewayRouteName : 'gateway-http-route' ,
430
419
} ) ;
431
420
} ) . toThrow ( / P r e f i x p a t h f o r t h e m a t c h m u s t s t a r t w i t h \' \/ \' , g o t : t e s t \/ / ) ;
432
-
433
-
434
421
expect ( ( ) => {
435
422
virtualGateway . addGatewayRoute ( 'gateway-http2-route' , {
436
423
routeSpec : appmesh . GatewayRouteSpec . http2 ( {
@@ -442,8 +429,6 @@ describe('gateway route', () => {
442
429
gatewayRouteName : 'gateway-http2-route' ,
443
430
} ) ;
444
431
} ) . toThrow ( / W h e n p r e f i x p a t h f o r t h e r e w r i t e i s s p e c i f i e d , p r e f i x p a t h f o r t h e m a t c h m u s t e n d w i t h \' \/ \' , g o t : \/ t e s t / ) ;
445
-
446
-
447
432
} ) ;
448
433
449
434
test ( "should throw an error if the custom prefix does not start and end with '/'" , ( ) => {
@@ -488,8 +473,6 @@ describe('gateway route', () => {
488
473
gatewayRouteName : 'gateway-http2-route' ,
489
474
} ) ;
490
475
} ) . toThrow ( / P r e f i x p a t h f o r t h e r e w r i t e m u s t s t a r t a n d e n d w i t h \' \/ \' , g o t : \/ r e w r i t t e n U r i / ) ;
491
-
492
-
493
476
} ) ;
494
477
} ) ;
495
478
@@ -535,7 +518,7 @@ describe('gateway route', () => {
535
518
} ) ;
536
519
537
520
// THEN
538
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
521
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
539
522
GatewayRouteName : 'gateway-http-route' ,
540
523
Spec : {
541
524
HttpRoute : {
@@ -545,13 +528,13 @@ describe('gateway route', () => {
545
528
} ,
546
529
} ,
547
530
Action : {
548
- Rewrite : ABSENT ,
531
+ Rewrite : Match . absent ( ) ,
549
532
} ,
550
533
} ,
551
534
} ,
552
535
} ) ;
553
536
554
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
537
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
555
538
GatewayRouteName : 'gateway-grpc-route' ,
556
539
Spec : {
557
540
GrpcRoute : {
@@ -563,8 +546,6 @@ describe('gateway route', () => {
563
546
} ,
564
547
} ,
565
548
} ) ;
566
-
567
-
568
549
} ) ;
569
550
} ) ;
570
551
@@ -610,7 +591,7 @@ describe('gateway route', () => {
610
591
} ) ;
611
592
612
593
// THEN
613
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
594
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
614
595
GatewayRouteName : 'gateway-grpc-route' ,
615
596
Spec : {
616
597
GrpcRoute : {
@@ -681,8 +662,6 @@ describe('gateway route', () => {
681
662
} ,
682
663
} ,
683
664
} ) ;
684
-
685
-
686
665
} ) ;
687
666
688
667
test ( 'should throw an error if the array length is invalid' , ( ) => {
@@ -742,8 +721,6 @@ describe('gateway route', () => {
742
721
gatewayRouteName : 'gateway-grpc-route' ,
743
722
} ) ;
744
723
} ) . toThrow ( / N u m b e r o f m e t a d a t a p r o v i d e d f o r m a t c h i n g m u s t b e b e t w e e n 1 a n d 1 0 / ) ;
745
-
746
-
747
724
} ) ;
748
725
} ) ;
749
726
@@ -790,7 +767,7 @@ describe('gateway route', () => {
790
767
} ) ;
791
768
792
769
// THEN
793
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
770
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
794
771
GatewayRouteName : 'gateway-http-route' ,
795
772
Spec : {
796
773
HttpRoute : {
@@ -861,8 +838,6 @@ describe('gateway route', () => {
861
838
} ,
862
839
} ,
863
840
} ) ;
864
-
865
-
866
841
} ) ;
867
842
} ) ;
868
843
@@ -898,7 +873,7 @@ describe('gateway route', () => {
898
873
} ) ;
899
874
900
875
// THEN
901
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
876
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
902
877
GatewayRouteName : 'gateway-http-route' ,
903
878
Spec : {
904
879
HttpRoute : {
@@ -908,8 +883,6 @@ describe('gateway route', () => {
908
883
} ,
909
884
} ,
910
885
} ) ;
911
-
912
-
913
886
} ) ;
914
887
} ) ;
915
888
@@ -956,7 +929,7 @@ describe('gateway route', () => {
956
929
} ) ;
957
930
958
931
// THEN
959
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
932
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
960
933
GatewayRouteName : 'gateway-http-route' ,
961
934
Spec : {
962
935
HttpRoute : {
@@ -966,13 +939,13 @@ describe('gateway route', () => {
966
939
} ,
967
940
} ,
968
941
Action : {
969
- Rewrite : ABSENT ,
942
+ Rewrite : Match . absent ( ) ,
970
943
} ,
971
944
} ,
972
945
} ,
973
946
} ) ;
974
947
975
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
948
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
976
949
GatewayRouteName : 'gateway-http2-route' ,
977
950
Spec : {
978
951
Http2Route : {
@@ -984,8 +957,6 @@ describe('gateway route', () => {
984
957
} ,
985
958
} ,
986
959
} ) ;
987
-
988
-
989
960
} ) ;
990
961
991
962
test ( 'should throw an error if empty string is passed' , ( ) => {
@@ -1019,8 +990,6 @@ describe('gateway route', () => {
1019
990
gatewayRouteName : 'gateway-http-route' ,
1020
991
} ) ;
1021
992
} ) . toThrow ( / E x a c t P a t h f o r t h e r e w r i t e c a n n o t b e e m p t y . U n l i k e s t a r t s W i t h \( \) m e t h o d , n o a u t o m a t i c r e w r i t e o n w h o l e p a t h m a t c h / ) ;
1022
-
1023
-
1024
993
} ) ;
1025
994
} ) ;
1026
995
@@ -1058,7 +1027,7 @@ describe('gateway route', () => {
1058
1027
} ) ;
1059
1028
1060
1029
// THEN
1061
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
1030
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
1062
1031
GatewayRouteName : 'gateway-http-route' ,
1063
1032
Spec : {
1064
1033
HttpRoute : {
@@ -1075,8 +1044,6 @@ describe('gateway route', () => {
1075
1044
} ,
1076
1045
} ,
1077
1046
} ) ;
1078
-
1079
-
1080
1047
} ) ;
1081
1048
} ) ;
1082
1049
} ) ;
@@ -1112,7 +1079,7 @@ describe('gateway route', () => {
1112
1079
} ) ;
1113
1080
1114
1081
// THEN
1115
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
1082
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
1116
1083
GatewayRouteName : 'gateway-http-route' ,
1117
1084
Spec : {
1118
1085
HttpRoute : {
@@ -1157,7 +1124,7 @@ describe('gateway route', () => {
1157
1124
} ) ;
1158
1125
1159
1126
// THEN
1160
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
1127
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
1161
1128
Spec : {
1162
1129
Priority : 100 ,
1163
1130
} ,
@@ -1197,7 +1164,7 @@ describe('gateway route', () => {
1197
1164
} ) ;
1198
1165
1199
1166
// THEN
1200
- expect ( stack ) . toHaveResourceLike ( 'AWS::AppMesh::GatewayRoute' , {
1167
+ Template . fromStack ( stack ) . hasResourceProperties ( 'AWS::AppMesh::GatewayRoute' , {
1201
1168
Spec : {
1202
1169
Priority : 500 ,
1203
1170
} ,
0 commit comments