Are there any libraries out there to mock localStorage?
localStorage
I\'ve been using Sinon.JS for most of my other javascript mocking and have found it is really gr
This is what I do...
var mock = (function() { var store = {}; return { getItem: function(key) { return store[key]; }, setItem: function(key, value) { store[key] = value.toString(); }, clear: function() { store = {}; } }; })(); Object.defineProperty(window, 'localStorage', { value: mock, });