mirror of
https://github.com/Turfjs/turf.git
synced 2026-02-01 16:57:21 +00:00
Turf-Truncate - Add precision & coordinates tests
This commit is contained in:
parent
53d0264a8f
commit
7104445e78
@ -29,6 +29,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/Turfjs/turf",
|
||||
"devDependencies": {
|
||||
"@turf/helpers": "^3.13.0",
|
||||
"benchmark": "^1.0.0",
|
||||
"load-json-file": "^2.0.0",
|
||||
"tape": "^3.5.0",
|
||||
|
||||
@ -3,6 +3,7 @@ const test = require('tape');
|
||||
const path = require('path');
|
||||
const load = require('load-json-file');
|
||||
const write = require('write-json-file');
|
||||
const point = require('@turf/helpers').point;
|
||||
const truncate = require('./');
|
||||
|
||||
const directories = {
|
||||
@ -28,3 +29,10 @@ test('truncate', t => {
|
||||
}
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('truncate - precision & coordinates', t => {
|
||||
t.deepEqual(truncate(point([50.1234567, 40.1234567]), 3).geometry.coordinates, [50.123, 40.123], 'precision 3')
|
||||
t.deepEqual(truncate(point([50.1234567, 40.1234567]), 0).geometry.coordinates, [50, 40], 'precision 0')
|
||||
t.deepEqual(truncate(point([50, 40, 1100]), 6, 2).geometry.coordinates, [50, 40], 'coordinates 2')
|
||||
t.end()
|
||||
})
|
||||
Loading…
x
Reference in New Issue
Block a user