1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-23 20:07:40 +02:00
unleash.unleash/test/fixtures/fake-addon-store.js

26 lines
583 B
JavaScript
Raw Normal View History

'use strict';
module.exports = () => {
const _addons = [];
return {
insert: async addon => {
const a = { id: _addons.length, ...addon };
_addons.push(a);
return a;
},
update: async (id, value) => {
_addons[id] = value;
Promise.resolve(value);
},
delete: async id => {
_addons.splice(id, 1);
Promise.resolve();
},
get: async id => {
return _addons[id];
},
getAll: () => Promise.resolve(_addons),
};
};