1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/test/fixtures/fake-strategies-store.js
Ivar Conradi Østhus d01c9d2dac
fix: use airbnb lint rules directly (#583)
This drops usage of finn-eslint rules as they are no
longer maintained.
2020-04-14 22:29:11 +02:00

22 lines
698 B
JavaScript

'use strict';
const NotFoundError = require('../../lib/error/notfound-error');
module.exports = () => {
const _strategies = [{ name: 'default', editable: false, parameters: {} }];
return {
getStrategies: () => Promise.resolve(_strategies),
getEditableStrategies: () =>
Promise.resolve(_strategies.filter(s => s.editable)),
getStrategy: name => {
const strategy = _strategies.find(s => s.name === name);
if (strategy) {
return Promise.resolve(strategy);
}
return Promise.reject(new NotFoundError('Not found!'));
},
addStrategy: strat => _strategies.push(strat),
};
};