1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/test/fixtures/fake-client-applications-store.js

30 lines
784 B
JavaScript
Raw Normal View History

2016-12-06 09:27:32 +01:00
'use strict';
const NotFoundError = require('../../lib/error/notfound-error');
2018-11-29 21:45:26 +01:00
module.exports = () => {
2020-09-25 09:39:12 +02:00
let apps = [];
2018-01-17 15:31:53 +01:00
2018-11-29 21:45:26 +01:00
return {
upsert: app => {
apps.push(app);
return Promise.resolve();
},
insertNewRow: value => {
apps.push(value);
return Promise.resolve();
},
2018-11-29 21:45:26 +01:00
getApplications: () => Promise.resolve(apps),
2020-09-25 09:39:12 +02:00
getApplication: appName => {
const app = apps.filter(a => a.appName === appName)[0];
if (!app) {
throw new NotFoundError(`Could not find app=${appName}`);
2020-09-25 09:39:12 +02:00
}
return app;
},
deleteApplication: appName => {
apps = apps.filter(app => app.appName !== appName);
},
2018-11-29 21:45:26 +01:00
};
};