Skip to content

Commit

Permalink
Add 'buildIdentifyWMSRequest should honour queryLayers' test
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Oct 20, 2016
1 parent 9297c8d commit 00f9317
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion web/client/utils/__tests__/MapInfoUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ var {
getAvailableInfoFormatValues,
getDefaultInfoFormatValue,
createBBox,
getProjectedBBox
getProjectedBBox,
buildIdentifyWMSRequest
} = require('../MapInfoUtils');

describe('MapInfoUtils', () => {
Expand Down Expand Up @@ -80,4 +81,47 @@ describe('MapInfoUtils', () => {
expect(bbox.maxx).toBeGreaterThan(bbox.minx);
expect(bbox.maxy).toBeGreaterThan(bbox.miny);
});

it('buildIdentifyWMSRequest should honour queryLayers', () => {
let props = {
map: {
zoom: 0,
projection: 'EPSG:4326'
},
point: {
latlng: {
lat: 0,
lng: 0
}
}
};
let layer1 = {
type: "wms",
queryLayers: ["sublayer1", "sublayer2"],
name: "layer",
url: "http://localhost"
};
let req1 = buildIdentifyWMSRequest(layer1, props);
expect(req1.request).toExist();
expect(req1.request.query_layers).toEqual("sublayer1,sublayer2");

let layer2 = {
type: "wms",
name: "layer",
url: "http://localhost"
};
let req2 = buildIdentifyWMSRequest(layer2, props);
expect(req2.request).toExist();
expect(req2.request.query_layers).toEqual("layer");

let layer3 = {
type: "wms",
name: "layer",
queryLayers: [],
url: "http://localhost"
};
let req3 = buildIdentifyWMSRequest(layer3, props);
expect(req3.request).toExist();
expect(req3.request.query_layers).toEqual("");
});
});

0 comments on commit 00f9317

Please sign in to comment.