-
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.
feat: split package exports into matcher and core functionality
package.json: Created the entry routes and a separate test script specifically for testing coordinates. Each category will get its own script for ease of development. readme: Updated the configuration and core importing sections. typedefinitions.js: newly created file solely for JSDoc type defs. matchers.js: Exports the matcher functions grouped into objects by category. core.js: Exports the core functionality grouped into objects by category. setup: Moving all setup scripts into this folder. Creates a separate script for each group as well as an overall script to load everything. Resolves: #5
- Loading branch information
1 parent
e5ae40f
commit a7340d9
Showing
12 changed files
with
142 additions
and
29 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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = { | ||
setupFilesAfterEnv: ['./src/JestSetup.js'] | ||
setupFilesAfterEnv: ['./src/setup/all.js'] | ||
} |
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 was deleted.
Oops, something went wrong.
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,7 @@ | ||
/* eslint-disable global-require */ | ||
|
||
exports.coordinates = { | ||
valid2DCoordinate: require('./core/coordinates/valid2DCoordinate'), | ||
valid3DCoordinate: require('./core/coordinates/valid3DCoordinate'), | ||
validCoordinate: require('./core/coordinates/validCoordinate') | ||
} |
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,21 @@ | ||
// This file exports all matchers grouped within an object named after their categories. | ||
// Any new matchers must get added to their individual files. | ||
|
||
/* eslint-disable global-require */ | ||
|
||
// Bounding Boxes | ||
|
||
// Coordinates | ||
exports.coordinates = { | ||
isValid2DCoordinate: require('./matchers/coordinates/isValid2DCoordinate').isValid2DCoordinate, | ||
isValid3DCoordinate: require('./matchers/coordinates/isValid3DCoordinate').isValid3DCoordinate, | ||
isValidCoordinate: require('./matchers/coordinates/isValidCoordinate').isValidCoordinate | ||
} | ||
|
||
// Features | ||
|
||
// Geometries | ||
|
||
// Properties | ||
|
||
// Winding |
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,18 @@ | ||
const matchers = require('../matchers') | ||
|
||
exports.throwJestRuntimeError = () => { | ||
throw new Error( | ||
"Unable to find Jest's global expect.\n\n" + | ||
'Please check you have added jest-geojson correctly to your jest configuration.\n\n' + | ||
'For help, see https://github.com/M-Scott-Lassiter/jest-geojson/tree/beta#configure-jest\n\n' | ||
) | ||
} | ||
|
||
const jestExpect = global.expect | ||
|
||
if (jestExpect !== undefined) { | ||
expect.extend(matchers.coordinates) | ||
// expect.extend(matchers.boundingBoxes) | ||
} else { | ||
exports.throwJestRuntimeError() | ||
} |
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,10 @@ | ||
const matchers = require('../matchers') | ||
const { throwJestRuntimeError } = require('./all') | ||
|
||
const jestExpect = global.expect | ||
|
||
if (jestExpect !== undefined) { | ||
expect.extend(matchers.coordinates) | ||
} else { | ||
throwJestRuntimeError() | ||
} |
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,17 @@ | ||
// These tests do nothing but verify that the exported objects have all expected functions. | ||
|
||
const core = require('../src/core') | ||
|
||
describe('Coordinate Functions Exported', () => { | ||
test('valid2DCoordinate', () => { | ||
expect('valid2DCoordinate' in core.coordinates).toBeTruthy() | ||
}) | ||
|
||
test('valid3DCoordinate', () => { | ||
expect('valid3DCoordinate' in core.coordinates).toBeTruthy() | ||
}) | ||
|
||
test('validCoordinate', () => { | ||
expect('validCoordinate' in core.coordinates).toBeTruthy() | ||
}) | ||
}) |
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,17 @@ | ||
// These tests do nothing but verify that the exported objects have all expected functions. | ||
|
||
const matchers = require('../src/matchers') | ||
|
||
describe('Coordinate Functions Exported', () => { | ||
test('isValid2DCoordinate', () => { | ||
expect('isValid2DCoordinate' in matchers.coordinates).toBeTruthy() | ||
}) | ||
|
||
test('isValid3DCoordinate', () => { | ||
expect('isValid3DCoordinate' in matchers.coordinates).toBeTruthy() | ||
}) | ||
|
||
test('isValidCoordinate', () => { | ||
expect('isValidCoordinate' in matchers.coordinates).toBeTruthy() | ||
}) | ||
}) |