Skip to content

Commit

Permalink
Add longitude tests #758 @turf/hex-grid
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed May 28, 2017
1 parent e3ff6bf commit b708a1f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/turf-hex-grid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
},
"homepage": "https://github.com/Turfjs/turf",
"devDependencies": {
"@turf/meta": "^4.3.0",
"@turf/truncate": "^4.3.0",
"benchmark": "^2.1.4",
"load-json-file": "^2.0.0",
Expand Down
18 changes: 18 additions & 0 deletions packages/turf-hex-grid/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path');
const load = require('load-json-file');
const write = require('write-json-file');
const truncate = require('@turf/truncate');
const {coordEach} = require('@turf/meta');
const grid = require('./');

const directories = {
Expand Down Expand Up @@ -68,3 +69,20 @@ test('hex-tri-grid', t => {

t.end();
});

test('longitude (13141439571036224) issue #758', t => {
const bbox = [-179, -90, 179, 90];
const cellSize = 1;
const units = 'kilometers';
const hexgrid = grid(bbox, cellSize, units);
let fail;
coordEach(hexgrid, ([lng, lat]) => {
if (!fail) {
if (lng > 1000 || lng < -1000) {
t.fail(`longitude is +- 1000 [${lng},${lat}]`);
fail = true;
}
}
});
t.end();
});

0 comments on commit b708a1f

Please sign in to comment.