diff --git a/test/spec/ol/format/wms/singlelayer.xml b/test/spec/ol/format/wms/singlelayer.xml new file mode 100644 index 0000000000..9feb76d839 --- /dev/null +++ b/test/spec/ol/format/wms/singlelayer.xml @@ -0,0 +1,146 @@ + + + + WMS + Acme Corp. Map Server + Map Server maintained by Acme Corporation. Contact: webmaster@wmt.acme.com. High-quality maps showing roadrunner nests and possible ambush locations. + + + bird + roadrunner + ambush + + + + + + + Jeff Smith + NASA + + Computer Scientist + + + postal +
NASA Goddard Space Flight Center
+ Greenbelt + MD + 20771 + + USA +
+ +1 301 555-1212 + user@host.com +
+ + none + + none + 16 + 2048 + 2048 +
+ + + + + text/xml + + + + + + + + + + + + + + image/gif + image/png + image/jpeg + + + + + + + + + + + + text/xml + text/plain + text/html + + + + + + + + + + + + XML + + INIMAGE + BLANK + + + ROADS_1M + Roads at 1:1M scale + Roads at a scale of 1 to 1 million. + + + road + transportation + atlas + + 123456 + + + text/plain + + + + text/xml + + + + + + + +
diff --git a/test/spec/ol/format/wmscapabilities.test.js b/test/spec/ol/format/wmscapabilities.test.js index dba7bc60ba..4ab1282068 100644 --- a/test/spec/ol/format/wmscapabilities.test.js +++ b/test/spec/ol/format/wmscapabilities.test.js @@ -160,3 +160,40 @@ describe('ol.format.WMSCapabilities', function () { }); }); }); + +describe('ol.format.WMSCapabilities', function () { + describe('when parsing singlelayer.xml', function () { + const parser = new WMSCapabilities(); + let capabilities; + before(function (done) { + afterLoadText('spec/ol/format/wms/singlelayer.xml', function (xml) { + try { + capabilities = parser.read(xml); + } catch (e) { + done(e); + } + done(); + }); + }); + + it('can read version', function () { + expect(capabilities.version).to.eql('1.3.0'); + }); + + it('can read Service section', function () { + // FIXME not all fields are tested + const service = capabilities.Service; + + expect(service.Name).to.eql('WMS'); + expect(service.Title).to.eql('Acme Corp. Map Server'); + }); + + it('can read Capability.Layer', function () { + const layer = capabilities.Capability.Layer; + + expect(layer.Title).to.eql('Roads at 1:1M scale'); + expect(layer.Name).to.be('ROADS_1M'); + expect(layer.queryable).to.be(true); + }); + }); +});