Ref.
Last active
November 13, 2019 00:22
-
-
Save pluto-atom-4/08ef55e2aaab2d2001b48282c08dbf6e to your computer and use it in GitHub Desktop.
jest-notes
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
expect.extend({ | |
toContainObject(received, argument) { | |
const pass = this.equals(received, | |
expect.arrayContaining([ | |
expect.objectContaining(argument) | |
]) | |
) | |
if (pass) { | |
return { | |
message: () => (`expected ${this.utils.printReceived(received)} not to contain object ${this.utils.printExpected(argument)}`), | |
pass: true | |
} | |
} else { | |
return { | |
message: () => (`expected ${this.utils.printReceived(received)} to contain object ${this.utils.printExpected(argument)}`), | |
pass: false | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment