@@ -51,24 +51,30 @@ Given(/body from file "(.*)"/, function (this: World, filename: string) {
5151Given (
5252 "request contains {string} parameter from {string}" ,
5353 function ( this : World , parameterName : string , fixturePath : string ) {
54- this . opts [ parameterName . toAttributeName ( ) ] = pathLookup (
55- this . fixtures ,
56- fixturePath
57- ) ;
54+ const value = pathLookup ( this . fixtures , fixturePath ) ;
55+ this . opts [ parameterName . toAttributeName ( ) ] = value ;
56+ // Store in pathParameters for undo operations with naming variants
57+ this . pathParameters [ parameterName ] = value ;
58+ this . pathParameters [ parameterName . toAttributeName ( ) ] = value ;
5859 }
5960) ;
6061
6162Given (
6263 / r e q u e s t c o n t a i n s " ( [ ^ " ] + ) " p a r a m e t e r w i t h v a l u e ( .* ) / ,
6364 function ( this : World , parameterName : string , value : string ) {
64- this . opts [ parameterName . toAttributeName ( ) . toOperationName ( ) ] = JSON . parse (
65- value . templated ( this . fixtures )
66- ) ;
65+ const parsedValue = JSON . parse ( value . templated ( this . fixtures ) ) ;
66+ const attrName = parameterName . toAttributeName ( ) . toOperationName ( ) ;
67+ this . opts [ attrName ] = parsedValue ;
68+ // Store in pathParameters for undo operations with naming variants
69+ this . pathParameters [ parameterName ] = parsedValue ;
70+ this . pathParameters [ attrName ] = parsedValue ;
6771 }
6872) ;
6973
7074Given ( "new {string} request" , function ( this : World , operationId : string ) {
7175 this . operationId = operationId ;
76+ this . opts = { } ;
77+ this . pathParameters = { } ; // Clear path parameters for new request
7278} ) ;
7379
7480When ( "the request is sent" , async function ( this : World ) {
@@ -155,7 +161,7 @@ When("the request is sent", async function (this: World) {
155161 this . operationId ,
156162 this . response ,
157163 this . opts ,
158- this . opts // Pass opts as pathParameters (contains all parameters including path ones)
164+ this . pathParameters // Pass dedicated pathParameters
159165 )
160166 ) ;
161167 }
0 commit comments