We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I use last version of React and try to write test in Jest:
const getItemSpy = jest.spyOn(localStorage, 'getItem'); getItemSpy.mockReturnValue(null);
and got error: TypeError: getItemSpy.mockReturnValue is not a function
If I run: console.log(getItemSpy.mockReturnValue);
It shows undefined
What's the problem?
The text was updated successfully, but these errors were encountered:
This has nothing to do with swc, its jest issue you need to spy on LocalStorage.prototype
Sorry, something went wrong.
also mockReturnvalue is a setter, not sure if that will return anything
No branches or pull requests
I use last version of React and try to write test in Jest:
const getItemSpy = jest.spyOn(localStorage, 'getItem');
getItemSpy.mockReturnValue(null);
and got error:
TypeError: getItemSpy.mockReturnValue is not a function
If I run:
console.log(getItemSpy.mockReturnValue);
It shows undefined
What's the problem?
The text was updated successfully, but these errors were encountered: