diff --git a/x-pack/test/lists_api_integration/security_and_spaces/tests/create_lists.ts b/x-pack/test/lists_api_integration/security_and_spaces/tests/create_lists.ts index 0372e93f8ba465..1385662f40c208 100644 --- a/x-pack/test/lists_api_integration/security_and_spaces/tests/create_lists.ts +++ b/x-pack/test/lists_api_integration/security_and_spaces/tests/create_lists.ts @@ -43,15 +43,35 @@ export default ({ getService }: FtrProviderContext) => { await deleteListsIndex(supertest); }); - it('should create a list with a list_id', async () => { + it('should create a simple list with a list_id', async () => { const { body } = await supertest .post(LIST_URL) .set('kbn-xsrf', 'true') - .send(getCreateMinimalListSchemaMock()); + .send(getCreateMinimalListSchemaMock()) + .expect(200); const bodyToCompare = removeServerGeneratedProperties(body); expect(bodyToCompare).to.eql(getListResponseMockWithoutAutoGeneratedValues()); }); + + it('should cause a 409 conflict if we attempt to create the same list_id twice', async () => { + await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(200); + + const { body } = await supertest + .post(LIST_URL) + .set('kbn-xsrf', 'true') + .send(getCreateMinimalListSchemaMock()) + .expect(409); + + expect(body).to.eql({ + message: 'list id: "some-list-id" already exists', + status_code: 409, + }); + }); }); }); };