@@ -53,8 +53,13 @@ describe('Utils - generateManifest', () => {
53
53
rules : {
54
54
request : [
55
55
{
56
- name : 'testRule' ,
57
- match : '/test' ,
56
+ name : 'rewriteRule' ,
57
+ match : '/path' ,
58
+ capture : {
59
+ match : '^(./)([^/])$' ,
60
+ captured : 'other' ,
61
+ subject : 'uri' ,
62
+ } ,
58
63
rewrite : {
59
64
match : '^(./)([^/])$' ,
60
65
set : ( other ) => `/${ other [ 0 ] } /${ other [ 1 ] } ` ,
@@ -70,8 +75,8 @@ describe('Utils - generateManifest', () => {
70
75
expect . objectContaining ( {
71
76
name : 'capture_match_groups' ,
72
77
target : expect . objectContaining ( {
73
- captured_array : 'other' ,
74
78
regex : '^(./)([^/])$' ,
79
+ captured_array : 'other' ,
75
80
// eslint-disable-next-line no-template-curly-in-string
76
81
subject : '${uri}' ,
77
82
} ) ,
@@ -426,7 +431,7 @@ describe('Utils - generateManifest', () => {
426
431
) ;
427
432
} ) ;
428
433
429
- it ( 'should throw an error if setHeaders is not a string ' , ( ) => {
434
+ it ( 'should throw an error if setHeaders is not an array of strings ' , ( ) => {
430
435
const azionConfig = {
431
436
rules : {
432
437
request : [
@@ -440,7 +445,7 @@ describe('Utils - generateManifest', () => {
440
445
} ;
441
446
442
447
expect ( ( ) => jsToJson ( azionConfig ) ) . toThrow (
443
- "The 'setHeaders' field must be a string or null ." ,
448
+ "The 'setHeaders' field must be an array of strings ." ,
444
449
) ;
445
450
} ) ;
446
451
@@ -491,14 +496,14 @@ describe('Utils - generateManifest', () => {
491
496
) ;
492
497
} ) ;
493
498
494
- it ( 'should correctly add setHeaders behavior with a valid string ' , ( ) => {
499
+ it ( 'should correctly add setHeaders behavior with a valid array ' , ( ) => {
495
500
const azionConfig = {
496
501
rules : {
497
502
request : [
498
503
{
499
504
name : 'testRule' ,
500
505
match : '/' ,
501
- setHeaders : 'Authorization: Bearer abc123' ,
506
+ setHeaders : [ 'Authorization: Bearer abc123' ] , // Corretamente definido como uma array de strings
502
507
} ,
503
508
] ,
504
509
} ,
0 commit comments