jest-localstorage-mock
Advanced tools
Comparing version 2.4.7 to 2.4.8
{ | ||
"name": "jest-localstorage-mock", | ||
"version": "2.4.7", | ||
"version": "2.4.8", | ||
"description": "Auto mock all localstorage and sessionstorage APIs for your Jest tests", | ||
@@ -5,0 +5,0 @@ "main": "dist/setup.js", |
@@ -169,10 +169,11 @@ Use this module with [Jest](https://facebook.github.io/jest/) to run web tests | ||
beforeEach(() => { | ||
// values stored in tests will also be available in other tests unless you run | ||
// to fully reset the state between tests, clear the storage | ||
localStorage.clear(); | ||
// or directly reset the storage | ||
// and reset all mocks | ||
jest.clearAllMocks(); | ||
// clearAllMocks will impact your other mocks too, so you can optionally reset individual mocks instead: | ||
localStorage.setItem.mockClear(); | ||
// you can also directly reset the storage (same as .clear above) | ||
localStorage.__STORE__ = {}; | ||
// you could also reset all mocks, but this could impact your other mocks | ||
jest.resetAllMocks(); | ||
// or individually reset a mock used | ||
localStorage.setItem.mockClear(); | ||
}); | ||
@@ -179,0 +180,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20728
201