R
Reactiflux

Adi – 11-07 Jan 19

Adi – 11-07 Jan 19

AAdi1/19/2022
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; } }); ‘’’
SScriptyChris1/19/2022
window.localStorage.proto is non-existing property. You rather meant window.localStorage.prototype
AAdi1/19/2022
Ok got it thanks a lot
SScriptyChris1/19/2022
you can react to the answer with ✅ to mark thread as solved
UUUnknown User1/20/2022
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!

R
Reactiflux

Adi – 11-07 Jan 19

Join Server