I am trying to mock getItem of localstorage but it is not returning null when I execute test why so? ‘’’ jest .spyOn(window.localStorage.proto, 'getItem') .mockImplementation((key): any => { if (key === 'sampleKey') { return null; } }); ‘’’
Continue the conversation
Join the Discord to ask follow-up questions and connect with the community
R
Reactiflux
The largest chat community for React professionals