Skip to content

Commit

Permalink
more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck committed Sep 22, 2020
1 parent 6db0ad3 commit f09e7b0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
Binary file not shown.
41 changes: 23 additions & 18 deletions x-pack/plugins/maps/server/mvt/get_tile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,34 @@ describe('getGridTile', () => {

beforeEach(() => {
mockCallElasticsearch.mockReset();
});

test('0.0.0 tile (clusters)', async () => {
mockCallElasticsearch.mockImplementation((type) => {
return TILE_GRIDAGGS['0.0.0'].gridAggResponse;
});
});

const tile = await getGridTile({
x: 0,
y: 0,
z: 0,
index: 'manhattan',
requestBody,
geometryFieldName,
logger: ({
info: () => {},
} as unknown) as Logger,
callElasticsearch: mockCallElasticsearch,
requestType: RENDER_AS.POINT,
geoFieldType: ES_GEO_FIELD_TYPE.GEO_POINT,
});
const defaultParams = {
x: 0,
y: 0,
z: 0,
index: 'manhattan',
requestBody,
geometryFieldName,
logger: ({
info: () => {},
} as unknown) as Logger,
callElasticsearch: mockCallElasticsearch,
requestType: RENDER_AS.POINT,
geoFieldType: ES_GEO_FIELD_TYPE.GEO_POINT,
};

test('0.0.0 tile (clusters)', async () => {
const tile = await getGridTile(defaultParams);
compareTiles('./__tests__/pbf/0_0_0_grid_aspoint.pbf', tile);
});

compareTiles('./__tests__/pbf/0_0_0_grid.pbf', tile);
test('0.0.0 tile (grids)', async () => {
const tile = await getGridTile({ ...defaultParams, requestType: RENDER_AS.GRID });
compareTiles('./__tests__/pbf/0_0_0_grid_asgrid.pbf', tile);
});
});

Expand Down

0 comments on commit f09e7b0

Please sign in to comment.