timkindberg / jest-when

Jest support for mock argument-matched return values.
MIT License
734 stars 38 forks source link

Can't use calledWith null using 3.3.0 #68

Closed eranelbaz closed 3 years ago

eranelbaz commented 3 years ago

Seems like this usage of jest-when is broke on version 3.3.0, and work using 3.2.0

const fn = jest.fn();
when(fn).calledWith(null).mockReturnValue('yay!');
expect(fn(null)).toBe('yay!');

the test is failing and i get this in the logs

TypeError: Cannot read property '_isAllArgsFunctionMatcher' of null

versions -

"jest-when": "^3.3.0",
"jest": "26.6.3"

Thanks

timkindberg commented 3 years ago

https://github.com/timkindberg/jest-when/releases/tag/v3.3.1

timkindberg commented 3 years ago

Thanks for the bug report!!