MCPcopy
hub / github.com/ampproject/amphtml / fakeLocalStorage

Function fakeLocalStorage

test/unit/test-experiments.js:18–24  ·  view source on GitHub ↗
(initial = {})

Source from the content-addressed store, hash-verified

16} from '#experiments';
17
18function fakeLocalStorage(initial = {}) {
19 const state = {...initial};
20 return {
21 getItem: (key) => (key in state ? state[key] : null),
22 setItem: (key, value) => (state[key] = value),
23 };
24}
25
26describes.sandboxed('experimentToggles', {}, () => {
27 it('should return experiment status map', () => {

Callers 2

expectToggleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected