Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] Fix apis Maps endpoints getTile should return vector tile containing document #114509

Merged
merged 7 commits into from
Oct 12, 2021
27 changes: 21 additions & 6 deletions x-pack/test/api_integration/apis/maps/get_tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@ import Protobuf from 'pbf';
import expect from '@kbn/expect';
import { MVT_SOURCE_LAYER_NAME } from '../../../../plugins/maps/common/constants';

function findFeature(layer, callbackFn) {
for (let i = 0; i < layer.length; i++) {
const feature = layer.feature(i);
if (callbackFn(feature)) {
return feature;
}
}
}

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

// FAILING ES PROMOTION: https://github.com/elastic/kibana/issues/114471
describe.skip('getTile', () => {
describe('getTile', () => {
it('should return vector tile containing document', async () => {
const resp = await supertest
.get(
Expand All @@ -32,8 +40,12 @@ export default function ({ getService }) {
const layer = jsonTile.layers[MVT_SOURCE_LAYER_NAME];
expect(layer.length).to.be(3); // 2 docs + the metadata feature

// 1st doc
const feature = layer.feature(0);
// Verify ES document

const feature = findFeature(layer, (feature) => {
return feature.properties._id === 'AU_x3_BsGFA8no6Qjjug';
});
expect(feature).not.to.be(undefined);
expect(feature.type).to.be(1);
expect(feature.extent).to.be(4096);
expect(feature.id).to.be(undefined);
Expand All @@ -46,8 +58,11 @@ export default function ({ getService }) {
});
expect(feature.loadGeometry()).to.eql([[{ x: 44, y: 2382 }]]);

// Metadata feature
const metadataFeature = layer.feature(2);
// Verify metadata feature
const metadataFeature = findFeature(layer, (feature) => {
return feature.properties.__kbn_metadata_feature__;
});
expect(metadataFeature).not.to.be(undefined);
expect(metadataFeature.type).to.be(3);
expect(metadataFeature.extent).to.be(4096);
expect(metadataFeature.id).to.be(undefined);
Expand Down