Skip to content

Commit

Permalink
fix: date time testing
Browse files Browse the repository at this point in the history
  • Loading branch information
gkocak-scottlogic authored and ColinEberhardt committed Mar 29, 2023
1 parent 500b067 commit ff6609a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions features/support/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,12 @@ Then(
/the response should have a property ([a-zA-Z]*) with value (.*)/,
(propName, propValue) => {
const value = apiResponse.data[propName];
const formattedValue =
value instanceof Date ? value.toISOString() : value.toString();
assert.equal(formattedValue, propValue);
if (value instanceof Date) {
// JS/TS does not differentiate date/date-time. Need to construct prop date and compare.
assert.equal(value.toISOString(), new Date(propValue).toISOString());
} else {
assert.equal(value.toString(), propValue);
}
}
);

Expand Down

0 comments on commit ff6609a

Please sign in to comment.