-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automated Testing #14
Conversation
- still needs to fix
- error: 'latLonToTileCoords is not a function' (find out why this error occurs) - somehow all tests are failing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for getting started on this!
Regarding automation, this should just be a straightforward Github Action for testing JavaScript, as documented here: https://docs.github.com/en/[email protected]/actions/automating-builds-and-tests/building-and-testing-nodejs
For the first test suite, I'd stick to the kind of unit tests you have now -- testing callouts is going to be far more complicated. It would probably require a fair bit of refactoring to decouple the sound output, among many other things.
app/js/spatial/geo.js
Outdated
@@ -1,8 +1,12 @@ | |||
// Copyright (c) Daniel W. Steinbrook. | |||
// with many thanks to ChatGPT | |||
|
|||
const turf = require('@turf/turf'); | |||
|
|||
module.exports = { createBoundingBox , enumerateTilesInBoundingBox, getLocation, watchLocation, geoToXY}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This syntax might work in Node from the command line, but breaks in a browser. I'd think there should be a way to get Mocha to work while keeping ES6 module syntax like we have now. See: https://stackoverflow.com/questions/46487307/is-it-possible-to-use-es6-modules-in-mocha-tests
utilizedes6 syntax for geo and test.js and now need to figure out why some of the tests are wrong
After much trial-and-error, I figured out how to get turf in the global namespace for tests without needing to add any imports to the source files (see tests/setup.js). I also added a Github Action to automate these (see .github/workflows/node.js.yml). Your tests will run on every future commit and pull request! |
Reason:
Resolves Issue: Automated Testing #6
Changes:
Decided to use mocha for testing
Began working on unit tests for basic mathematical questions
Questions: