mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
parent
f190954b06
commit
e42ecd794f
2 changed files with 26 additions and 1 deletions
|
@ -10,7 +10,7 @@ import { MAX_SPACE_INITIALS } from '../../common/constants';
|
|||
export const spaceSchema = Joi.object({
|
||||
id: Joi.string().regex(/[a-z0-9_\-]*/, `lower case, a-z, 0-9, "_", and "-" are allowed`),
|
||||
name: Joi.string().required(),
|
||||
description: Joi.string(),
|
||||
description: Joi.string().allow(''),
|
||||
initials: Joi.string().max(MAX_SPACE_INITIALS),
|
||||
color: Joi.string().regex(/^#[a-z0-9]{6}$/, `6 digit hex color, starting with a #`),
|
||||
_reserved: Joi.boolean(),
|
||||
|
|
|
@ -64,6 +64,31 @@ describe('Spaces Public API', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('PUT /space should allow an empty description', async () => {
|
||||
const payload = {
|
||||
id: 'a-space',
|
||||
name: 'my updated space',
|
||||
description: '',
|
||||
};
|
||||
|
||||
const { mockSavedObjectsRepository, response } = await request(
|
||||
'PUT',
|
||||
'/api/spaces/space/a-space',
|
||||
{
|
||||
payload,
|
||||
}
|
||||
);
|
||||
|
||||
const { statusCode } = response;
|
||||
|
||||
expect(statusCode).toEqual(200);
|
||||
expect(mockSavedObjectsRepository.update).toHaveBeenCalledTimes(1);
|
||||
expect(mockSavedObjectsRepository.update).toHaveBeenCalledWith('space', 'a-space', {
|
||||
name: 'my updated space',
|
||||
description: '',
|
||||
});
|
||||
});
|
||||
|
||||
test(`returns result of routePreCheckLicense`, async () => {
|
||||
const payload = {
|
||||
id: 'a-space',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue