I would like to mock localStorage methods in jest for error simulation. I have localstorage getter and setter methods defined in utility.js. I would like to mock local
To access something that is in the global scope of your module under test, you need to use the global namespace. So to access localStorage use global.localStorage: