@camptocamp/ogc-client
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -64,14 +64,11 @@ import { EndpointError } from '../shared/errors'; | ||
this._capabilitiesPromise = useCache( | ||
() => | ||
parseWmsCapabilities(capabilitiesUrl.toString()).then( | ||
({ info, layers, version }) => { | ||
this._info = info; | ||
this._layers = layers; | ||
this._version = version; | ||
} | ||
), | ||
() => parseWmsCapabilities(capabilitiesUrl.toString()), | ||
'WMS', | ||
'CAPABILITIES', | ||
capabilitiesUrl.toString() | ||
); | ||
).then(({ info, layers, version }) => { | ||
this._info = info; | ||
this._layers = layers; | ||
this._version = version; | ||
}); | ||
@@ -78,0 +75,0 @@ /** |
{ | ||
"name": "@camptocamp/ogc-client", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A pure JS library for interacting with geospatial services.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/dist-node.js", |
@@ -40,4 +40,16 @@ import capabilities200 from '../../fixtures/wfs/capabilities-pigma-2-0-0.xml'; | ||
it('uses cache', () => { | ||
expect(useCache).toHaveBeenCalledTimes(1); | ||
describe('caching', () => { | ||
beforeEach(async () => { | ||
await endpoint.isReady(); | ||
}); | ||
it('uses cache once', () => { | ||
expect(useCache).toHaveBeenCalledTimes(1); | ||
}); | ||
it('stores the parsed capabilities in cache', async () => { | ||
await expect(useCache.mock.results[0].value).resolves.toMatchObject({ | ||
info: { | ||
title: "Service WFS de l'IDS régionale PIGMA", | ||
}, | ||
}); | ||
}); | ||
}); | ||
@@ -44,0 +56,0 @@ |
@@ -64,14 +64,11 @@ import { EndpointError } from '../shared/errors'; | ||
this._capabilitiesPromise = useCache( | ||
() => | ||
parseWmsCapabilities(capabilitiesUrl.toString()).then( | ||
({ info, layers, version }) => { | ||
this._info = info; | ||
this._layers = layers; | ||
this._version = version; | ||
} | ||
), | ||
() => parseWmsCapabilities(capabilitiesUrl.toString()), | ||
'WMS', | ||
'CAPABILITIES', | ||
capabilitiesUrl.toString() | ||
); | ||
).then(({ info, layers, version }) => { | ||
this._info = info; | ||
this._layers = layers; | ||
this._version = version; | ||
}); | ||
@@ -78,0 +75,0 @@ /** |
@@ -28,4 +28,16 @@ import capabilities130 from '../../fixtures/wms/capabilities-brgm-1-3-0.xml'; | ||
it('uses cache', () => { | ||
expect(useCache).toHaveBeenCalledTimes(1); | ||
describe('caching', () => { | ||
beforeEach(async () => { | ||
await endpoint.isReady(); | ||
}); | ||
it('uses cache once', () => { | ||
expect(useCache).toHaveBeenCalledTimes(1); | ||
}); | ||
it('stores the parsed capabilities in cache', async () => { | ||
await expect(useCache.mock.results[0].value).resolves.toMatchObject({ | ||
info: { | ||
title: 'GéoServices : géologie, hydrogéologie et gravimétrie', | ||
}, | ||
}); | ||
}); | ||
}); | ||
@@ -32,0 +44,0 @@ |
Sorry, the diff of this file is too big to display
609051
14823