-
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Condense
toBeBeforeOrEqualTo
matcher into one file
- Loading branch information
1 parent
df3f191
commit 225235d
Showing
6 changed files
with
21 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export function toBeBeforeOrEqualTo(actual, expected) { | ||
const { matcherHint, printReceived } = this.utils; | ||
|
||
const passMessage = () => | ||
matcherHint('.not.toBeBeforeOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be before or equal to ${printReceived(expected)} but received:\n` + | ||
` ${printReceived(actual)}`; | ||
|
||
const failMessage = () => | ||
matcherHint('.toBeBeforeOrEqualTo', 'received', '') + | ||
'\n\n' + | ||
`Expected date to be before or equal to ${printReceived(expected)} but received:\n` + | ||
` ${printReceived(actual)}`; | ||
|
||
const pass = actual <= expected; | ||
const message = pass ? passMessage : failMessage; | ||
|
||
return { pass, message }; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...atchers/toBeBeforeOrEqualTo/index.test.js → test/matchers/toBeBeforeOrEqualTo.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters