Open
Description
Hey,
I was using key
and value
dummy strings and it took me a while to figure out that key
behaves differently in jest-localstorage-mock
than other random strings:
console.log(localStorage.getItem("bla"));
console.log src/utils/ReactApp/ReactAppUtils.js:13
null
console.log(localStorage.getItem("key"));
console.log src/utils/ReactApp/ReactAppUtils.js:12
{ [Function: mockConstructor]
_isMockFunction: true,
getMockImplementation: [Function],
mock: [Getter/Setter],
mockClear: [Function],
mockReset: [Function],
mockRestore: [Function],
mockReturnValueOnce: [Function],
mockResolvedValueOnce: [Function],
mockRejectedValueOnce: [Function],
mockReturnValue: [Function],
mockResolvedValue: [Function],
mockRejectedValue: [Function],
mockImplementationOnce: [Function],
mockImplementation: [Function],
mockReturnThis: [Function],
mockName: [Function],
getMockName: [Function] }
While in my browser:
console.log(localStorage.getItem("key"));
// => null
I think this is pretty misleading. Perhaps it could be fixed or menioned in the readme?
Metadata
Metadata
Assignees
Labels
No labels