0

Hello I'm trying to test the functions of local storage, so when I set the local storage from one value, for example 'foo' and in an if else do something or another. But it never call it and I didn't really don't know how to test my values depends on what have the local storage has.

So how can I test it?

Any useful code would be great :)

Jonathan
  • 469
  • 1
  • 6
  • 20
  • 2
    Possible duplicate of [How do I deal with localStorage in jest tests?](https://stackoverflow.com/questions/32911630/how-do-i-deal-with-localstorage-in-jest-tests) – Sergeon Oct 10 '19 at 13:27
  • @Sergeon is very useful the link but I don't understand it :( I can be more concrete... This link is my real problem and I really don't know how to test it https://stackoverflow.com/questions/58300237/not-calling-getlocalstorage-from-the-function Could you help me? – Jonathan Oct 10 '19 at 13:44
  • Well your question is probably too wide, it is not clear what is your problem. Your tests fail because there is any 'localStorage is undefined' sort of error? Or the result of the test is unexpected? You should paste your code in order to allow people to help you. – Sergeon Oct 10 '19 at 13:51

0 Answers0