forked from koopjs/koop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'koopjs:master' into master
- Loading branch information
Showing
9 changed files
with
185 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: CI tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- next | ||
paths: | ||
- "**/packages/**/package.json" | ||
|
||
jobs: | ||
pr-tests: | ||
name: Install, lint, test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
os: [ubuntu-latest] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install npm 7 | ||
run: npm i -g npm@7 --registry=https://registry.npmjs.org | ||
|
||
- name: Install | ||
run: npm ci | ||
|
||
- name: Lint | ||
run: npm run lint:ci | ||
|
||
- name: Unit tests | ||
run: npm test --workspaces | ||
|
||
- name: E2E tests | ||
run: npm run test:e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ on: | |
pull_request: | ||
branches: | ||
- master | ||
- next | ||
- beta | ||
paths: | ||
- "./.github/**.yml" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
const should = require('should'); // eslint-disable-line | ||
const sinon = require('sinon'); | ||
const proxyquire = require('proxyquire'); | ||
|
||
describe('logWarnings', () => { | ||
const loggerSpy = sinon.spy(() => {}); | ||
|
||
const { logWarnings } = proxyquire('./log-warnings', { | ||
'../logger': { | ||
logger: { | ||
debug: loggerSpy, | ||
}, | ||
}, | ||
}); | ||
|
||
afterEach(() => { | ||
loggerSpy.resetHistory(); | ||
}); | ||
|
||
it('should log missing idField', () => { | ||
logWarnings({}); | ||
loggerSpy.callCount.should.equal(1); | ||
loggerSpy.firstCall.args.should.deepEqual([ | ||
'requested provider has no "idField" assignment. You will get the most reliable behavior from ArcGIS clients if the provider assigns the "idField" to a property that is an unchanging 32-bit integer. An OBJECTID field will be auto-generated in the absence of an "idField" assignment.', | ||
]); | ||
}); | ||
|
||
it('should log mixed-case OBJECTID', () => { | ||
logWarnings({ metadata: { idField: 'objEctId' } }); | ||
loggerSpy.callCount.should.equal(1); | ||
loggerSpy.firstCall.args.should.deepEqual([ | ||
'requested provider has "idField" that is a mixed-case version of "OBJECTID". This can cause errors in ArcGIS clients.', | ||
]); | ||
}); | ||
|
||
it('should log field definition not found in feature', () => { | ||
logWarnings({ | ||
metadata: { fields: [{ name: 'foo', type: 'String' }] }, | ||
features: [{ properties: {} }], | ||
}); | ||
loggerSpy.callCount.should.equal(2); | ||
loggerSpy.secondCall.args.should.deepEqual([ | ||
'field definition "foo (String)" not found in first feature of provider\'s GeoJSON', | ||
]); | ||
}); | ||
|
||
it('should log field definition - feature property type mismatch', () => { | ||
logWarnings({ | ||
metadata: { fields: [{ name: 'foo', type: 'String' }] }, | ||
features: [{ properties: { foo: 1000 } }], | ||
}); | ||
loggerSpy.callCount.should.equal(2); | ||
loggerSpy.secondCall.args.should.deepEqual([ | ||
'field definition "foo (String)" not found in first feature of provider\'s GeoJSON', | ||
]); | ||
}); | ||
|
||
it('should not log warning if field definition matches feature', () => { | ||
logWarnings({ | ||
metadata: { fields: [{ name: 'foo', type: 'String' }] }, | ||
features: [{ properties: { foo: 'bar' } }], | ||
}); | ||
loggerSpy.callCount.should.equal(1); | ||
}); | ||
|
||
it('should not log warning if field type mismatch is Esri exception', () => { | ||
logWarnings({ | ||
metadata: { fields: [{ name: 'foo', type: 'Date' }] }, | ||
features: [{ properties: { foo: 12345 } }], | ||
}); | ||
loggerSpy.callCount.should.equal(1); | ||
}); | ||
|
||
it('should log feature property not found in field definitions', () => { | ||
logWarnings({ | ||
metadata: { fields: [] }, | ||
features: [{ properties: { foo: 'bar' } }], | ||
}); | ||
loggerSpy.callCount.should.equal(2); | ||
loggerSpy.secondCall.args.should.deepEqual([ | ||
'requested provider has feature with property "foo" that was not defined in metadata fields array', | ||
]); | ||
}); | ||
}); |