1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00

fix: Variants should be allowed to be 'null'

This commit is contained in:
ivaosthu 2019-02-08 13:56:47 +01:00
parent e3a0569ebd
commit 494a98f926
3 changed files with 23 additions and 1 deletions

View File

@ -1,5 +1,9 @@
# Changelog
## 3.2.1
- fix: Variants should be allowed to be 'null'
## 3.2.0
- feat: Add beta support for toggle variants

View File

@ -50,7 +50,8 @@ const featureShema = joi
.array()
.unique((a, b) => a.name === b.name)
.optional()
.items(variantsSchema),
.items(variantsSchema)
.allow(null),
})
.options({ allowUnknown: false, stripUnknown: true });

View File

@ -100,6 +100,23 @@ test('should be allowed to use new toggle name', t => {
.expect(201);
});
test('should be allowed to have variants="null"', t => {
t.plan(0);
const { request, base, perms } = getSetup();
perms.withPermissions(CREATE_FEATURE);
return request
.post(`${base}/api/admin/features`)
.send({
name: 'new.name.null',
enabled: false,
strategies: [{ name: 'default' }],
variants: null,
})
.set('Content-Type', 'application/json')
.expect(201);
});
test('should not be allowed to reuse active toggle name', t => {
t.plan(1);
const { request, featureToggleStore, base } = getSetup();