1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/test/fixtures/fake-tag-type-store.js

18 lines
479 B
JavaScript
Raw Normal View History

const NotFoundError = require('../../lib/error/notfound-error');
module.exports = () => {
const _tagTypes = {};
return {
getTagType: async name => {
const tag = _tagTypes[name];
if (tag) {
return Promise.resolve(tag);
}
return Promise.reject(new NotFoundError('Could not find tag type'));
},
createTagType: async tag => {
_tagTypes[tag.name] = tag;
},
};
};