Skip to content

Commit ff6609a

Browse files
gkocak-scottlogicColinEberhardt
authored andcommitted
fix: date time testing
1 parent 500b067 commit ff6609a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

features/support/support.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,12 @@ Then(
138138
/the response should have a property ([a-zA-Z]*) with value (.*)/,
139139
(propName, propValue) => {
140140
const value = apiResponse.data[propName];
141-
const formattedValue =
142-
value instanceof Date ? value.toISOString() : value.toString();
143-
assert.equal(formattedValue, propValue);
141+
if (value instanceof Date) {
142+
// JS/TS does not differentiate date/date-time. Need to construct prop date and compare.
143+
assert.equal(value.toISOString(), new Date(propValue).toISOString());
144+
} else {
145+
assert.equal(value.toString(), propValue);
146+
}
144147
}
145148
);
146149

0 commit comments

Comments
 (0)