Adding a custom matcher for Date #315
shrey-png
started this conversation in
Show and tell
Replies: 1 comment
-
Just to add that I am happy to submit a PR for Date matcher, if someone could help in getting to it work. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Earl team, I have been trying to add a custom matcher for Date comparison, please refer to the example below:
expect(result.documents[0]).toEqual({
category: "cartoon",
publishedDate : "2024-10-09T01:15:04.747Z"
})
This test fails expectedly as publishedDate is a Date type and trying to compare it to a string value,
although I am looking for an exact match on date, I tried (publishedDate : expect.a.(Date)) assertion as well, but that didn't seem to work.
I have have gone through Earl's documentation and tried to add a custom matcher for Date, but that doesn't seem to work either.
Can someone please suggest what's the best way for matching dates in a json using Matchers.
Thanks,
Shrey
Beta Was this translation helpful? Give feedback.
All reactions