localStorage.tsx 290 B

1234567891011121314
  1. const localStorageMock = function () {
  2. let store = {};
  3. return {
  4. getItem: jest.fn(key => store[key]),
  5. setItem: jest.fn((key, value) => {
  6. store[key] = value.toString();
  7. }),
  8. clear: jest.fn(() => {
  9. store = {};
  10. }),
  11. };
  12. };
  13. export default localStorageMock();