Skip to content

Commit 2ebda28

Browse files
committed
test
1 parent b072349 commit 2ebda28

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

features/step_definitions/request_steps.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,30 @@ Given(/body from file "(.*)"/, function (this: World, filename: string) {
5151
Given(
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

6162
Given(
6263
/request contains "([^"]+)" parameter with value (.*)/,
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

7074
Given("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

7480
When("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

Comments
 (0)