1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/test/fixtures/fake-addon-store.js
2021-02-05 15:20:00 +01:00

26 lines
583 B
JavaScript

'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),
};
};