Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/client/utils/WMSUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const getLayerOptions = function(capabilities) {
return isObject(capabilities)
? {
capabilities,
description: capabilities.Abstract,
...(capabilities.Abstract && capabilities.Abstract !== '' && { description: capabilities.Abstract }),
boundingBox: capabilities?.EX_GeographicBoundingBox
? {
minx: capabilities.EX_GeographicBoundingBox?.westBoundLongitude,
Expand Down
27 changes: 27 additions & 0 deletions web/client/utils/__tests__/WMSUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,33 @@ describe('Test the WMSUtils', () => {
availableStyles: [{ name: 'generic' }]
});
});
it('test getLayerOptions with empty or no Abstract', () => {
expect(getLayerOptions()).toEqual({});
const capabilities = {
Style: { Name: 'generic' },
LatLonBoundingBox: {$: { minx: -180, miny: -90, maxx: 180, maxy: 90 }}
};

const capabilities2 = {
Style: { Name: 'generic' },
Abstract: '',
LatLonBoundingBox: {$: { minx: -180, miny: -90, maxx: 180, maxy: 90 }}
};
// should not contain description if Abstract is undefined
expect(getLayerOptions(capabilities))
.toEqual({
capabilities,
boundingBox: { minx: -180, miny: -90, maxx: 180, maxy: 90 },
availableStyles: [{ name: 'generic' }]
});
// should not contain description if Abstract is empty string
expect(getLayerOptions(capabilities2))
.toEqual({
capabilities: capabilities2,
boundingBox: { minx: -180, miny: -90, maxx: 180, maxy: 90 },
availableStyles: [{ name: 'generic' }]
});
});
it('test getTileGridFromLayerOptions', () => {
const tileGrids = [
{
Expand Down