MyCrypto/jest_config/__mocks__/localStorage.ts
James Prado 70a2b3ca9a Update Jest & Enzyme, Add snapshot tests (#307)
* Add disclaimer modal to footer

* Remove duplicate code & unnecessary styles

* Fix formatting noise

* remove un-used css style

* Fix tslint error & add media query for modals

* Nest Media Query

* Update Jest & Enzyme, Add snapshot tests

* Fix tslint errors in /spec, Update mock localstorage

* Update types in tests, Fix tslint error

* Specify module versions for browser

* Update sendTransaction snapshot
2017-10-24 19:17:26 -07:00

28 lines
419 B
TypeScript

class LocalStorageMock {
private store: object;
constructor() {
this.store = {};
}
public clear() {
this.store = {};
}
public getItem(key) {
return this.store[key];
}
public setItem(key, value) {
this.store[key] = value.toString();
}
public removeItem(key) {
delete this.store[key];
}
}
Object.defineProperty(window, 'localStorage', {
value: new LocalStorageMock()
});