[Endpoint] TEST: GET alert details - boundary test for first alert retrieval (#60320)

* boundary test for first alert retrieval

* boundary test for first alert retrieval cleaned up

* redo merge conflict resolving for api test

* redo merge conflict resolving for api test try 2

* updating to current dataset expectations

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Eric Davis 2020-03-19 17:10:56 -04:00 committed by GitHub
parent b2b5fcedcc
commit 347160b71a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -215,7 +215,7 @@ export default function({ getService }: FtrProviderContext) {
expect(body.result_from_index).to.eql(0);
});
it('should return alert details by id', async () => {
it('should return alert details by id, getting last alert', async () => {
const documentID = 'zbNm0HABdD75WLjLYgcB';
const prevDocumentID = '2rNm0HABdD75WLjLYgcU';
const { body } = await supertest
@ -227,6 +227,18 @@ export default function({ getService }: FtrProviderContext) {
expect(body.next).to.eql(null); // last alert, no more beyond this
});
it('should return alert details by id, getting first alert', async () => {
const documentID = 'p7Nm0HABdD75WLjLYghv';
const nextDocumentID = 'mbNm0HABdD75WLjLYgho';
const { body } = await supertest
.get(`/api/endpoint/alerts/${documentID}`)
.set('kbn-xsrf', 'xxx')
.expect(200);
expect(body.id).to.eql(documentID);
expect(body.next).to.eql(`/api/endpoint/alerts/${nextDocumentID}`);
expect(body.prev).to.eql(null); // first alert, no more before this
});
it('should return 404 when alert is not found', async () => {
await supertest
.get('/api/endpoint/alerts/does-not-exist')