-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathdescribelayer.spec.ts
More file actions
42 lines (39 loc) · 1.46 KB
/
describelayer.spec.ts
File metadata and controls
42 lines (39 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { parseDescribeLayerResponse } from './describelayer.js';
// @ts-expect-error ts-migrate(7016)
import describeLayerResponse from '../../fixtures/wms/describelayer-response.xml';
import { parseXmlString } from '../shared/xml-utils.js';
describe('WMS DescribeLayer', () => {
describe('parseDescribeLayerResponse', () => {
it('parses a vector layer description (owsType WFS)', () => {
const doc = parseXmlString(describeLayerResponse);
const result = parseDescribeLayerResponse(
doc,
'my_workspace:my_vector_layer'
);
expect(result).toEqual({
layerName: 'my_workspace:my_vector_layer',
owsType: 'WFS',
owsUrl: 'https://my-server.com/wfs?',
typeName: 'my_workspace:my_vector_layer',
});
});
it('parses a raster layer description (owsType WCS)', () => {
const doc = parseXmlString(describeLayerResponse);
const result = parseDescribeLayerResponse(
doc,
'my_workspace:my_raster_layer'
);
expect(result).toEqual({
layerName: 'my_workspace:my_raster_layer',
owsType: 'WCS',
owsUrl: 'https://my-server.com/wcs?',
typeName: 'my_workspace:my_raster_layer',
});
});
it('returns null when the layer is not found in the response', () => {
const doc = parseXmlString(describeLayerResponse);
const result = parseDescribeLayerResponse(doc, 'nonexistent:layer');
expect(result).toBeNull();
});
});
});