Skip to content

Commit 376b5d1

Browse files
gkocak-scottlogicColinEberhardt
authored andcommitted
fix: date time testing
1 parent 0f1c6c7 commit 376b5d1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

features/support/api.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,12 @@ export class ModelSteps extends BaseModelStep {
166166
@then(/the response should have a property ([a-zA-Z]*) with value (.*)/)
167167
public checkResponseProperty(propName: string, propValue: string) {
168168
const value = this.apiResponse.data[propName];
169-
const formattedValue =
170-
value instanceof Date ? value.toISOString() : value.toString();
171-
assert.equal(formattedValue, propValue);
169+
if (value instanceof Date) {
170+
// JS/TS does not differentiate date/date-time. Need to construct prop date and compare.
171+
assert.equal(value.toISOString(), new Date(propValue).toISOString());
172+
} else {
173+
assert.equal(value.toString(), propValue);
174+
}
172175
}
173176

174177
@then(/the response should be an array/)

0 commit comments

Comments
 (0)