1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/lib/routes/admin-api/feature-schema.test.js
2020-02-20 08:34:18 +01:00

28 lines
692 B
JavaScript

'use strict';
const test = require('ava');
const { featureShema } = require('./feature-schema');
const joi = require('joi');
test('should require URL firendly name', t => {
const toggle = {
name: 'io`dasd',
enabled: false,
strategies: [{ name: 'default' }],
};
const { error } = joi.validate(toggle, featureShema);
t.deepEqual(error.details[0].message, '"name" must be URL friendly');
});
test('should be valid toggle name', t => {
const toggle = {
name: 'app.name',
enabled: false,
strategies: [{ name: 'default' }],
};
const { value } = joi.validate(toggle, featureShema);
t.deepEqual(value, toggle);
});