1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/test/fixtures/fake-feature-toggle-store.js
2020-02-20 08:34:06 +01:00

22 lines
660 B
JavaScript

'use strict';
module.exports = () => {
const _features = [];
const _archive = [];
return {
getFeature: name => {
const toggle = _features.find(f => f.name === name);
if (toggle) {
return Promise.resolve(toggle);
} else {
return Promise.reject();
}
},
getFeatures: () => Promise.resolve(_features),
hasFeatureName: () => Promise.resolve(false),
addFeature: feature => _features.push(feature),
getArchivedFeatures: () => Promise.resolve(_archive),
addArchivedFeature: feature => _archive.push(feature),
};
};