Skip to content

Commit

Permalink
chore: add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
rgwozdz committed Feb 27, 2024
1 parent b26ec67 commit 1c0ca5e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
8 changes: 7 additions & 1 deletion packages/featureserver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,13 @@ If you are using FeatureServer as part of a Koop instance, FeatureServer is regi
```js
const koop = new Koop({
geoservicesDefaults: { currentVersion: 99.0 }
geoservicesDefaults: {
currentVersion: 99.0 // set your own version number
fullVersion: '99.9.9'
layer: {
supportedQueryFormats: 'JSON' // allowed values include 'JSON', 'JSON,geojson'; default is 'JSON,geojson,PBF'
}
}
});

```
30 changes: 27 additions & 3 deletions test/geoservice-defaults.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@ const VERSION = 11.2;
const FULL_VERSION = '11.2.0';

describe('Geoservices defaults settings', () => {
const koop = new Koop({ logLevel: 'error', geoservicesDefaults: { currentVersion: VERSION, fullVersion: FULL_VERSION } });
const koop = new Koop({
logLevel: 'error',
geoservicesDefaults: {
currentVersion: VERSION,
fullVersion: FULL_VERSION,
layer: { supportedQueryFormats: 'JSON' },
},
});
koop.register(provider, { dataDir: './test/provider-data' });
test('should return server metadata with expected version', async () => {
try {
const response = await request(koop.server).get('/file-geojson/rest/services/polygon/FeatureServer');
const response = await request(koop.server).get(
'/file-geojson/rest/services/polygon/FeatureServer',
);
expect(response.status).toBe(200);
expect(response.body.currentVersion).toBe(11.2);
} catch (error) {
Expand All @@ -20,12 +29,27 @@ describe('Geoservices defaults settings', () => {

test('should return layer metadata with expected version', async () => {
try {
const response = await request(koop.server).get('/file-geojson/rest/services/polygon/FeatureServer/0');
const response = await request(koop.server).get(
'/file-geojson/rest/services/polygon/FeatureServer/0',
);
expect(response.status).toBe(200);
expect(response.body.currentVersion).toBe(11.2);
} catch (error) {
console.error(error);
throw error;
}
});

test('should return layer metadata with expected "supportedQueryFormats"', async () => {
try {
const response = await request(koop.server).get(
'/file-geojson/rest/services/polygon/FeatureServer/0',
);
expect(response.status).toBe(200);
expect(response.body.supportedQueryFormats).toBe('JSON');
} catch (error) {
console.error(error);
throw error;
}
});
});

0 comments on commit 1c0ca5e

Please sign in to comment.