Skip to content

Commit

Permalink
test: Add testing for header parameters
Browse files Browse the repository at this point in the history
* add testing for header parameters

* remove blank lines
  • Loading branch information
Joe-Dunleavy authored Sep 27, 2022
1 parent 6440b8a commit aa0eb18
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions features/support/api.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { binding, after, then, when, given } from "cucumber-tsflow";
import { assert } from "chai";

import { assert, expect } from "chai";
import { RequestParameters } from "../../template/request";

import { BaseModelStep } from "./base";

const isJson = (str: string): boolean => {
Expand Down Expand Up @@ -81,6 +79,11 @@ export class ModelSteps extends BaseModelStep {
assert.equal(this.requestParams.body, body);
}

@then(/the request should have a header property with value (.*)/)
public checkRequestHeaders(headerParam: string) {
expect(this.requestParams.headers).to.have.property("test", headerParam)
}

@when(/calling the method ([a-zA-Z]*) and the server provides an empty response/)
public async callWithoutResponse(methodName: string) {
this.serverResponseObject = null;
Expand Down Expand Up @@ -125,4 +128,4 @@ export class ModelSteps extends BaseModelStep {
public extractAtIndex(index: string) {
this.apiResponse = this.apiResponse[parseInt(index)];
}
}
}

0 comments on commit aa0eb18

Please sign in to comment.