mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-28 00:06:53 +01:00
Fixed failing tests
This commit is contained in:
parent
7c5aa8e5bb
commit
578751ef94
@ -13,6 +13,7 @@ describe('The event api', function () {
|
|||||||
|
|
||||||
mockery.registerSubstitute('./eventDb', '../test/eventDbMock');
|
mockery.registerSubstitute('./eventDb', '../test/eventDbMock');
|
||||||
mockery.registerSubstitute('./featureDb', '../test/featureDbMock');
|
mockery.registerSubstitute('./featureDb', '../test/featureDbMock');
|
||||||
|
mockery.registerSubstitute('./strategyDb', '../test/strategyDbMock');
|
||||||
|
|
||||||
server = require('../server');
|
server = require('../server');
|
||||||
request = request('http://localhost:' + server.app.get('port'));
|
request = request('http://localhost:' + server.app.get('port'));
|
||||||
|
@ -13,6 +13,7 @@ describe('EventStore', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
mockery.registerSubstitute('./eventDb', '../test/eventDbMock');
|
mockery.registerSubstitute('./eventDb', '../test/eventDbMock');
|
||||||
|
mockery.registerSubstitute('./strategyDb', '../test/strategyDbMock');
|
||||||
|
|
||||||
eventStore = require('../lib/eventStore');
|
eventStore = require('../lib/eventStore');
|
||||||
});
|
});
|
||||||
|
@ -13,6 +13,7 @@ describe('The api', function () {
|
|||||||
|
|
||||||
mockery.registerSubstitute('./eventDb', '../test/eventDbMock');
|
mockery.registerSubstitute('./eventDb', '../test/eventDbMock');
|
||||||
mockery.registerSubstitute('./featureDb', '../test/featureDbMock');
|
mockery.registerSubstitute('./featureDb', '../test/featureDbMock');
|
||||||
|
mockery.registerSubstitute('./strategyDb', '../test/strategyDbMock');
|
||||||
|
|
||||||
server = require('../server');
|
server = require('../server');
|
||||||
request = request('http://localhost:' + server.app.get('port'));
|
request = request('http://localhost:' + server.app.get('port'));
|
||||||
|
@ -13,6 +13,7 @@ describe('The routes', function () {
|
|||||||
|
|
||||||
mockery.registerSubstitute('./eventDb', '../test/eventDbMock');
|
mockery.registerSubstitute('./eventDb', '../test/eventDbMock');
|
||||||
mockery.registerSubstitute('./featureDb', '../test/featureDbMock');
|
mockery.registerSubstitute('./featureDb', '../test/featureDbMock');
|
||||||
|
mockery.registerSubstitute('./strategyDb', '../test/strategyDbMock');
|
||||||
|
|
||||||
server = require('../server');
|
server = require('../server');
|
||||||
request = request('http://localhost:' + server.app.get('port'));
|
request = request('http://localhost:' + server.app.get('port'));
|
||||||
|
37
test/strategyDbMock.js
Normal file
37
test/strategyDbMock.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
var Promise = require("bluebird");
|
||||||
|
|
||||||
|
var strategies = [
|
||||||
|
{
|
||||||
|
name: "default",
|
||||||
|
description: "Default on or off Strategy."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "usersWithEmail",
|
||||||
|
description: "Active for users defined in the comma-separated emails-parameter.",
|
||||||
|
parametersTemplate: {
|
||||||
|
emails: "String"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
function byName(name) {
|
||||||
|
return strategies.filter(function(s) {
|
||||||
|
return s.name === name;
|
||||||
|
})[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
getStrategies: function() {
|
||||||
|
return new Promise(function (resolve) {
|
||||||
|
resolve(strategies);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getFeature: function(name) {
|
||||||
|
var feature = byName(name);
|
||||||
|
if(feature) {
|
||||||
|
return Promise.resolve(feature);
|
||||||
|
} else {
|
||||||
|
return Promise.reject("strategy not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user