1234567891011121314 |
- const localStorageMock = function () {
- let store = {};
- return {
- getItem: jest.fn(key => store[key]),
- setItem: jest.fn((key, value) => {
- store[key] = value.toString();
- }),
- clear: jest.fn(() => {
- store = {};
- }),
- };
- };
- export default localStorageMock();
|