@@ -420,10 +420,10 @@ function build (opts = {}) {
420
420
const key = Object . keys ( action . match ) [ 0 ]
421
421
match (
422
422
// in some cases, the yaml refers to the body with an empty string
423
- key === '$body' || key === ''
423
+ key . split ( '.' ) [ 0 ] === '$body' || key === ''
424
424
? response
425
425
: delve ( response , fillStashedValues ( key ) ) ,
426
- key === '$body'
426
+ key . split ( '.' ) [ 0 ] === '$body'
427
427
? action . match [ key ]
428
428
: fillStashedValues ( action . match ) [ key ] ,
429
429
action . match
@@ -544,6 +544,8 @@ function match (val1, val2, action) {
544
544
// 'm' adds the support for multiline regex
545
545
assert . match ( val1 , new RegExp ( regStr , 'm' ) , `should match pattern provided: ${ val2 } , but got: ${ val1 } ` )
546
546
// everything else
547
+ } else if ( typeof val1 === 'string' && typeof val2 === 'string' ) {
548
+ assert . include ( val1 , val2 , `should match pattern provided: ${ val2 } , but got: ${ val1 } ` )
547
549
} else {
548
550
assert . equal ( val1 , val2 , `should be equal: ${ val1 } - ${ val2 } , action: ${ JSON . stringify ( action ) } ` )
549
551
}
@@ -640,6 +642,10 @@ function length (val, len) {
640
642
*/
641
643
function parseDo ( action ) {
642
644
action = JSON . parse ( JSON . stringify ( action ) )
645
+
646
+ if ( typeof action === 'string' ) action = { [ action ] : { } }
647
+ if ( Array . isArray ( action ) ) action = action [ 0 ]
648
+
643
649
return Object . keys ( action ) . reduce ( ( acc , val ) => {
644
650
switch ( val ) {
645
651
case 'catch' :
0 commit comments