Skip to content

Commit

Permalink
Adds more basics of the tests for lists
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHassanabad committed Aug 6, 2020
1 parent 216220a commit 7d1d940
Showing 1 changed file with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
});
});
};

0 comments on commit 7d1d940

Please sign in to comment.