Skip to content
New issue

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

localStorage key "key" is reserved? #102

Open
thisismydesign opened this issue Feb 10, 2019 · 3 comments · May be fixed by #104
Open

localStorage key "key" is reserved? #102

thisismydesign opened this issue Feb 10, 2019 · 3 comments · May be fixed by #104

Comments

@thisismydesign
Copy link

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?

@clarkbw
Copy link
Owner

clarkbw commented Feb 19, 2019

I believe this is because we haven't fixed #66 jump in there if you know a solution.

@clarkbw clarkbw closed this as completed Feb 19, 2019
@thisismydesign
Copy link
Author

I see. Why close this though if this is an actual issue?

@clarkbw
Copy link
Owner

clarkbw commented Feb 20, 2019

Ah, wrong button.

@clarkbw clarkbw reopened this Feb 20, 2019
@iagodahlem iagodahlem linked a pull request May 3, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants