Skip to content

Commit

Permalink
fix independent intance
Browse files Browse the repository at this point in the history
  • Loading branch information
XavierM committed Nov 25, 2024
1 parent 2e004f8 commit 14c5959
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,60 @@ describe('PUT /internal/spaces/space/{id}/solution', () => {
});
});

it('should update the solution_type when it is search', async () => {
const payload = {
solution_type: 'search',
};

const { routeHandler, savedObjectsRepositoryMock } = await setup();

const request = httpServerMock.createKibanaRequest({
params: {
id: 'a-space',
},
body: payload,
method: 'post',
});

const response = await routeHandler(mockRouteContext, request, kibanaResponseFactory);

const { status } = response;

expect(status).toEqual(200);
expect(savedObjectsRepositoryMock.update).toHaveBeenCalledTimes(1);
expect(savedObjectsRepositoryMock.update).toHaveBeenCalledWith('space', 'a-space', {
solution: 'es',
name: 'a space',
color: undefined,
description: undefined,
disabledFeatures: [],
imageUrl: undefined,
initials: undefined,
});
});

it('should failed when the solution_type is not the expected one', async () => {
const payload = {
solution_type: 'searchXoXo',
};

const { routeHandler } = await setup();

const request = httpServerMock.createKibanaRequest({
params: {
id: 'a-space',
},
body: payload,
method: 'post',
});

const response = await routeHandler(mockRouteContext, request, kibanaResponseFactory);

const { status } = response;

expect(status).toEqual(500);
});

it('should not allow a new space to be created', async () => {
const payload = {
solution: 'oblt',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const spaceSolutionSchema = schema.oneOf([
schema.literal('security'),
schema.literal('observability'),
schema.literal('elasticsearch'),
schema.literal('search'),
]),
}),
]);
Expand Down

0 comments on commit 14c5959

Please sign in to comment.