mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-26 01:17:00 +02:00
Fix failing tests
This commit is contained in:
parent
7d91f4c1d5
commit
ba5810506f
@ -3,7 +3,7 @@
|
||||
const { STRATEGY_CREATED, STRATEGY_DELETED } = require('../event-type');
|
||||
const logger = require('../logger');
|
||||
const NotFoundError = require('../error/notfound-error');
|
||||
const STRATEGY_COLUMNS = ['name', 'description', 'parameters_template'];
|
||||
const STRATEGY_COLUMNS = ['name', 'description', 'parameters'];
|
||||
const TABLE = 'strategies';
|
||||
|
||||
class StrategyStore {
|
||||
@ -44,7 +44,7 @@ class StrategyStore {
|
||||
return {
|
||||
name: row.name,
|
||||
description: row.description,
|
||||
parametersTemplate: row.parameters_template,
|
||||
parameters: row.parameters,
|
||||
};
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ class StrategyStore {
|
||||
return {
|
||||
name: data.name,
|
||||
description: data.description,
|
||||
parameters_template: data.parametersTemplate // eslint-disable-line
|
||||
parameters: JSON.stringify(data.parameters),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -48,14 +48,14 @@ function createStrategies (stores) {
|
||||
{
|
||||
name: 'default',
|
||||
description: 'Default on or off Strategy.',
|
||||
parametersTemplate: {},
|
||||
parameters: [],
|
||||
},
|
||||
{
|
||||
name: 'usersWithEmail',
|
||||
description: 'Active for users defined in the comma-separated emails-parameter.',
|
||||
parametersTemplate: {
|
||||
emails: 'String',
|
||||
},
|
||||
parameters: [
|
||||
{ name: 'emails', type: 'string' },
|
||||
],
|
||||
},
|
||||
].map(strategy => stores.strategyStore._createStrategy(strategy));
|
||||
}
|
||||
|
@ -14,6 +14,9 @@ test.serial('gets all strategies', async (t) => {
|
||||
.get('/api/strategies')
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200)
|
||||
.expect((res) => {
|
||||
t.true(res.body.strategies.length === 2, 'expected to have two strategies');
|
||||
})
|
||||
.then(destroy);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user