Skip to content

Commit

Permalink
chore: parameterize e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rgwozdz committed Sep 21, 2023
1 parent 4061d71 commit 87588a4
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 13 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
mocha: true,
jest: true,
jasmine: true,
node: true
node: true,
},
extends: 'eslint:recommended',
globals: {
Expand All @@ -20,9 +20,11 @@ module.exports = {
},
rules: {
'no-unused-vars': ['error', { ignoreRestSiblings: true }],
indent: ['error', 2, {'SwitchCase': 1}],
indent: ['error', 2, { SwitchCase: 1 }],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'no-only-tests/no-only-tests': 'error',
},
plugins: ['no-only-tests'],
};
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test": "npm test --workspaces",
"test:cov": "npm run test:cov --workspaces && npm run cov:compile && npm run cov:report",
"test:cov:unit": "npm run test:cov:unit --workspaces && npm run cov:compile:unit && npm run cov:report:unit",
"cov:compile": "nyc merge packages/cache-memory/.nyc_output .nyc_output/cache-memory.json && nyc merge packages/featureserver/.nyc_output .nyc_output/featureserver.json && nyc merge packages/core/.nyc_output .nyc_output/core.json && nyc merge packages/logger/.nyc_output .nyc_output/logger.json && cp packages/output-geoservices/coverage/coverage-final.json .nyc_output/output-geoservices.json && nyc merge packages/winnow/.nyc_output .nyc_output/winnow.json",
"cov:compile": "nyc merge packages/cache-memory/.nyc_output .nyc_output/cache-memory.json && nyc merge packages/featureserver/.nyc_output .nyc_output/featureserver.json && nyc merge packages/core/.nyc_output .nyc_output/core.json && nyc merge packages/logger/.nyc_output .nyc_output/logger.json && cp packages/output-geoservices/coverage/coverage-final.json .nyc_output/output-geoservices.json && nyc merge packages/winnow/.nyc_output .nyc_output/winnow.json",
"cov:compile:unit": "nyc merge packages/cache-memory/.nyc_output .nyc_output_unit/cache-memory.json && nyc merge packages/featureserver/.nyc_output_unit .nyc_output_unit/featureserver.json && nyc merge packages/core/.nyc_output .nyc_output_unit/core.json && nyc merge packages/logger/.nyc_output .nyc_output_unit/logger.json && cp packages/output-geoservices/coverage/coverage-final.json .nyc_output_unit/output-geoservices.json && nyc merge packages/winnow/.nyc_output_unit .nyc_output_unit/winnow.json",
"cov:report": "nyc report --reporter=html",
"cov:report:unit": "nyc report --temp-dir=.nyc_output_unit --report-dir=coverage_unit --reporter=html",
Expand Down Expand Up @@ -58,6 +58,7 @@
"cz-conventional-changelog": "^3.3.0",
"cz-git": "^1.7.1",
"eslint": "^8.49.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
"jest-coverage-badges-ng": "^1.0.1",
Expand Down
16 changes: 10 additions & 6 deletions test/geoservice-client-requests-no-geom.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const Koop = require('@koopjs/koop-core');
const provider = require('@koopjs/provider-file-geojson');
const request = require('supertest');
const VERSION = process.env.VERSION || 11.1;
const FULL_VERSION = process.env.VERSION || '11.1.0';
const mockLogger = {
debug: () => {},
info: () => {},
Expand Down Expand Up @@ -32,8 +34,8 @@ describe('Typical Geoservice Client request sequence: Dataset with no geometry',
);
const serverInfo = response.body;
expect(serverInfo).toEqual({
currentVersion: 11.1,
fullVersion: '11.1.0',
currentVersion: VERSION,
fullVersion: FULL_VERSION,
maxRecordCount: 2000,
serviceDescription:
'GeoJSON from no-geom-w-objectid.geojson',
Expand Down Expand Up @@ -96,8 +98,8 @@ describe('Typical Geoservice Client request sequence: Dataset with no geometry',
layers: [],
tables: [
{
currentVersion: 11.1,
fullVersion: '11.1.0',
currentVersion: VERSION,
fullVersion: FULL_VERSION,
id: 0,
name: 'no-geom-w-objectid.geojson',
type: 'Table',
Expand Down Expand Up @@ -210,8 +212,8 @@ describe('Typical Geoservice Client request sequence: Dataset with no geometry',
expect(response.status).toBe(200);
const info = response.body;
expect(info).toEqual({
currentVersion: 11.1,
fullVersion: '11.1.0',
currentVersion: VERSION,
fullVersion: FULL_VERSION,
id: 0,
name: 'no-geom-w-objectid.geojson',
type: 'Table',
Expand Down Expand Up @@ -674,4 +676,6 @@ describe('Typical Geoservice Client request sequence: Dataset with no geometry',
});
});
});
console.log(process.env.VERSION);
});

11 changes: 7 additions & 4 deletions test/helpers/client-response-fixtures.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
const VERSION = process.env.VERSION || 11.1;
const FULL_VERSION = process.env.VERSION || '11.1.0';

function getServerInfo(id) {
return {
currentVersion: 11.1,
fullVersion: '11.1.0',
currentVersion: VERSION,
fullVersion: FULL_VERSION,
maxRecordCount: 2000,
serviceDescription:
`GeoJSON from ${id}.geojson`,
Expand Down Expand Up @@ -54,8 +57,8 @@ function getLayersInfo(filename, idField) {
return {
layers: [
{
currentVersion: 11.1,
fullVersion: '11.1.0',
currentVersion: VERSION,
fullVersion: FULL_VERSION,
id: 0,
name: `${filename}.geojson`,
type: 'Feature Layer',
Expand Down

0 comments on commit 87588a4

Please sign in to comment.