@@ -342,6 +342,37 @@ describe('WMSCapabilitiesParser - attributions', () => {
342
342
expect ( layer . attributions [ 0 ] . name ) . toBe ( 'www.geo.admin.ch' )
343
343
expect ( layer . attributions [ 0 ] . url ) . toBe ( 'https://www.geo.admin.ch/attribution-bgdi' )
344
344
} )
345
+
346
+ it ( 'Parse layer attribution - invalid attribution URL' , ( ) => {
347
+ let content = `<?xml version='1.0' encoding="UTF-8" standalone="no"?>
348
+ <WMS_Capabilities version="1.3.0">
349
+ <Capability>
350
+ <Layer>
351
+ <Title>WMS BGDI</Title>
352
+ <Layer queryable="1" opaque="0" cascaded="1">
353
+ <Name>ch.swisstopo-vd.official-survey</Name>
354
+ <Title>OpenData-AV</Title>
355
+ <Attribution>
356
+ <OnlineResource
357
+ xmlns:xlink="http://www.w3.org/1999/xlink"
358
+ xlink:href="invalid-url"
359
+ />
360
+ </Attribution>
361
+ </Layer>
362
+ </Layer>
363
+ </Capability>
364
+ </WMS_Capabilities>
365
+ `
366
+ let capabilities = new WMSCapabilitiesParser ( content , 'https://wms.geo.admin.ch' )
367
+ // No attribution, use Service
368
+ let layer = capabilities . getExternalLayerObject ( 'ch.swisstopo-vd.official-survey' , WGS84 )
369
+ expect ( layer . externalLayerId ) . toBe ( 'ch.swisstopo-vd.official-survey' )
370
+ expectTypeOf ( layer . attributions ) . toBeArray ( )
371
+ expect ( layer . attributions . length ) . toBe ( 1 )
372
+ expectTypeOf ( layer . attributions [ 0 ] ) . toEqualTypeOf ( { name : 'string' , url : 'string' } )
373
+ expect ( layer . attributions [ 0 ] . name ) . toBe ( 'wms.geo.admin.ch' )
374
+ expect ( layer . attributions [ 0 ] . url ) . toBeNull ( )
375
+ } )
345
376
} )
346
377
347
378
describe ( 'WMSCapabilitiesParser - layer extent' , ( ) => {
0 commit comments