1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-09 00:18:00 +01:00

test: describe default stickiness bahavior in a test (#7379)

This commit is contained in:
Mateusz Kwasniewski 2024-06-12 16:49:50 +02:00 committed by GitHub
parent b5de65bb8e
commit 702ee8cb12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -734,3 +734,32 @@ test('Should return last seen at per environment', async () => {
);
expect(featureToggle.lastSeenAt).toEqual(new Date(lastSeenAtStoreDate));
});
test('Should return "default" for stickiness when creating a flexibleRollout strategy with empty stickiness', async () => {
const strategy = {
name: 'flexibleRollout',
parameters: {
rollout: '100',
stickiness: '',
},
constraints: [],
};
const feature = {
name: 'test-feature-stickiness-1',
description: 'the #1 feature',
};
const projectId = 'default';
await service.createFeatureToggle(projectId, feature, TEST_AUDIT_USER);
await service.createStrategy(
strategy,
{ projectId, featureName: feature.name, environment: DEFAULT_ENV },
TEST_AUDIT_USER,
);
const featureDB = await service.getFeature({ featureName: feature.name });
expect(featureDB.environments[0]).toMatchObject({
strategies: [{ parameters: { stickiness: 'default' } }],
});
});