1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-05 17:53:12 +02:00

fix duplicate test key for dbInit

This commit is contained in:
Christopher Kolstad 2021-09-16 11:09:49 +02:00
parent 1ae90f6942
commit e257be361b
No known key found for this signature in database
GPG Key ID: 559ACB0E3DB5538A
5 changed files with 27 additions and 7 deletions

View File

@ -174,6 +174,7 @@ class FeatureController extends Controller {
s,
createdFeature.project,
createdFeature.name,
userName,
),
),
);
@ -219,6 +220,7 @@ class FeatureController extends Controller {
s,
projectId,
featureName,
userName,
),
),
);

View File

@ -32,6 +32,7 @@ beforeAll(async () => {
strategy,
projectId,
toggle.name,
username,
);
};
@ -273,6 +274,7 @@ test('can not toggle of feature that does not exist', async () => {
test('can toggle a feature that does exist', async () => {
expect.assertions(0);
const featureName = 'existing.feature';
const username = 'toggle-feature';
const feature =
await app.services.featureToggleServiceV2.createFeatureToggle(
'default',
@ -285,6 +287,7 @@ test('can toggle a feature that does exist', async () => {
defaultStrategy,
'default',
featureName,
username,
);
return app.request
.post(`/api/admin/features/${feature.name}/toggle`)

View File

@ -57,6 +57,7 @@ beforeAll(async () => {
},
project,
feature1,
username,
);
await featureToggleServiceV2.createStrategy(
{

View File

@ -27,6 +27,8 @@ afterAll(async () => {
});
test('Should create feature toggle strategy configuration', async () => {
const projectId = 'default';
const username = 'feature-toggle';
const config: Omit<IStrategyConfig, 'id'> = {
name: 'default',
constraints: [],
@ -43,8 +45,9 @@ test('Should create feature toggle strategy configuration', async () => {
const createdConfig = await service.createStrategy(
config,
'default',
projectId,
'Demo',
username,
);
expect(createdConfig.name).toEqual('default');
@ -52,6 +55,8 @@ test('Should create feature toggle strategy configuration', async () => {
});
test('Should be able to update existing strategy configuration', async () => {
const projectId = 'default';
const username = 'existing-strategy';
const config: Omit<IStrategyConfig, 'id'> = {
name: 'default',
constraints: [],
@ -59,7 +64,7 @@ test('Should be able to update existing strategy configuration', async () => {
};
await service.createFeatureToggle(
'default',
projectId,
{
name: 'update-existing-strategy',
},
@ -70,11 +75,18 @@ test('Should be able to update existing strategy configuration', async () => {
config,
'default',
'update-existing-strategy',
username,
);
expect(createdConfig.name).toEqual('default');
const updatedConfig = await service.updateStrategy(createdConfig.id, {
parameters: { b2b: true },
});
const updatedConfig = await service.updateStrategy(
createdConfig.id,
GLOBAL_ENV,
projectId,
username,
{
parameters: { b2b: true },
},
);
expect(createdConfig.id).toEqual(updatedConfig.id);
expect(updatedConfig.parameters).toEqual({ b2b: true });
});
@ -96,7 +108,7 @@ test('Should include legacy props in event log when updating strategy configurat
userName,
);
await service.createStrategy(config, 'default', featureName);
await service.createStrategy(config, 'default', featureName, userName);
await service.updateEnabled(
'default',
featureName,
@ -112,6 +124,7 @@ test('Should include legacy props in event log when updating strategy configurat
});
test('Should be able to get strategy by id', async () => {
const userName = 'strategy';
const config: Omit<IStrategyConfig, 'id'> = {
name: 'default',
constraints: [],
@ -130,6 +143,7 @@ test('Should be able to get strategy by id', async () => {
config,
'default',
'Demo',
userName,
);
const fetchedConfig = await service.getStrategy(createdConfig.id);
expect(fetchedConfig).toEqual(createdConfig);

View File

@ -10,7 +10,7 @@ let userStore: IUserStore;
let currentUser;
beforeAll(async () => {
db = await dbInit('project_store_serial', getLogger);
db = await dbInit('user_feedback_store', getLogger);
stores = db.stores;
userFeedbackStore = stores.userFeedbackStore;
userStore = stores.userStore;