store.js
506 Bytes
/* global jest */
function recursiveProxy() {
const proxy = new Proxy(() => proxy, {
get(target, property) {
if (property === Symbol.toPrimitive) {
return () => "";
}
if (property === "length") {
return 0;
}
return proxy;
},
apply() {
return proxy;
},
});
return proxy;
}
const store = {
state: recursiveProxy(),
getters: recursiveProxy(),
dispatch: jest.fn(() => Promise.resolve()),
commit: jest.fn(),
};
module.exports = store;
module.exports.default = store;