Adi – 11-07 Jan 19
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;
}
});
‘’’
‘’’
jest
.spyOn(window.localStorage.proto, 'getItem')
.mockImplementation((key): any => {
if (key === 'sampleKey') {
return null;
}
});
‘’’
