What version of JSDOM are you using? The latest version has an implementation of localStorage ready to go, I think.
You can also use spies but I wouldnβt bother with using a package for it (although thatβs what I say about everything to be fair, so ymmv π€·ββοΈ)
Hereβs an example of how I used spies to test local storage in a React codebase (with Jest):
What version of JSDOM are you using? The latest version has an implementation of localStorage ready to go, I think.
You can also use spies but I wouldnβt bother with using a package for it (although thatβs what I say about everything to be fair, so ymmv π€·ββοΈ)
Hereβs an example of how I used spies to test local storage in a React codebase (with Jest):
github.com/PacktPublishing/Masteri...
So now I need to learn Jest or does Jasmine have spies, also I guess I need to find out what spies are lol.
I'm using whatever JSDOM you had in your dependency tree. I copied them out.
Jasmine has spies - jasmine.createSpy
Iβll see if I can port across the local storage tests to Svelte a little later today.