Skip to content

Commit

Permalink
add api test
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck committed Sep 1, 2020
1 parent 63671b2 commit b32edc5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions x-pack/test/api_integration/apis/maps/get_tile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export default function ({ getService }) {
const supertest = getService('supertest');

describe('getTile', () => {
it('should validate params', async () => {
await supertest
.get(
`/api/maps/mvt/getTile?x=15&y=11&z=5&geometryFieldName=coordinates&index=logstash*&requestBody=(_source:(includes:!(coordinates)),docvalue_fields:!(),query:(bool:(filter:!((match_all:())),must:!(),must_not:!(),should:!())),script_fields:(),size:10000,stored_fields:!(coordinates))`
)
.set('kbn-xsrf', 'kibana')
.expect(200);

This comment has been minimized.

Copy link
@nreese

nreese Sep 1, 2020

Contributor

Can you add a validation to check the returned payload size? That way we are verifying there is a return and will be notified if that return changes

});

it('should not validate when required params are missing', async () => {
await supertest
.get(
`/api/maps/mvt/getTile?&index=logstash*&requestBody=(_source:(includes:!(coordinates)),docvalue_fields:!(),query:(bool:(filter:!((match_all:())),must:!(),must_not:!(),should:!())),script_fields:(),size:10000,stored_fields:!(coordinates))`
)
.set('kbn-xsrf', 'kibana')
.expect(400);
});
});
}
1 change: 1 addition & 0 deletions x-pack/test/api_integration/apis/maps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function ({ loadTestFile, getService }) {
loadTestFile(require.resolve('./fonts_api'));
loadTestFile(require.resolve('./index_settings'));
loadTestFile(require.resolve('./migrations'));
loadTestFile(require.resolve('./get_tile'));
});
});
}

0 comments on commit b32edc5

Please sign in to comment.