Skip to content

Commit

Permalink
Automated Testing (#14)
Browse files Browse the repository at this point in the history
* create testing functions for functions in geo.js

- still needs to fix

* mocha and chai sucessfully compile

- error: 'latLonToTileCoords is not a function' (find out why this error occurs)
- somehow all tests are failing

* updated with es6 syntax

utilizedes6 syntax for geo and test.js and now need to figure out why some of the tests are wrong

* fixed test cases

* Add test automation; remove .DS_Store files;

* Add TurfJS to the global namespace when testing

---------

Co-authored-by: Daniel W. Steinbrook <[email protected]>
  • Loading branch information
jonha1 and steinbro authored May 4, 2024
1 parent 02b9d8d commit 59d6069
Show file tree
Hide file tree
Showing 8 changed files with 3,478 additions and 44 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
27 changes: 27 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Node.js CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
env/
node_modules/
TODO.md
4 changes: 2 additions & 2 deletions app/js/spatial/geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ export function createBoundingBox(latitude, longitude, radiusMeters) {

// Extract the bounding box coordinates
const bbox = turf.bbox(buffered);

return bbox;
}

// Function to convert latitude and longitude to Mercator tile coordinates
function latLonToTileCoords(latitude, longitude, zoom) {
export function latLonToTileCoords(latitude, longitude, zoom) {
const tileSize = 256; // Standard size for Mercator tiles
const scale = 1 << zoom;
const worldSize = tileSize * scale;
Expand Down
Loading

0 comments on commit 59d6069

Please sign in to comment.