-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support varargs in toHaveBeenCalledOnceWith (closes #517) #557
Conversation
I'm not sure this is the right way to solve this. It doesn't seem right... |
Codecov Report
@@ Coverage Diff @@
## main #557 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 73 73
Lines 673 673
Branches 289 289
=========================================
Hits 673 673
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@@ -16,7 +16,9 @@ export function toHaveBeenCalledOnceWith(received, expected) { | |||
} | |||
|
|||
const passOnce = received.mock.calls.length === 1; | |||
const pass = passOnce && this.equals(expected, received.mock.calls[0][0]); | |||
const mockCall = received.mock.calls[0]; | |||
const receivedArray = Array.isArray(mockCall) ? mockCall : [mockCall]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what exactly seems not right, perhaps my second suggestion will make it seem right? Haven't touched much of jest internals tho, so I probably don't know better. |
Thanks so much! Looking forward to getting this published to npm, cheers! |
No description provided.