react-map-gl/test/utils/fit-bounds.spec.js
Ib Green fa4ae3ffbb Buble+webpack2 (#169)
* Compile with buble and bundle with webpack
* Reduce number of dependencies
* Support for tree-shaking
* Standalone, easy-to-understand example with small package.json
* Tests now work under Node.js even when loading mapbox-gl.
* Fix travis config
2017-03-07 14:55:57 -08:00

21 lines
603 B
JavaScript

import test from 'tape-catch';
import {fitBounds} from 'react-map-gl';
const FITBOUNDS_TEST_CASES = [
{
width: 100,
height: 100,
bounds: [[-73.9876, 40.7661], [-72.9876, 41.7661]]
}
];
test('fitBounds', t => {
for (const testCase of FITBOUNDS_TEST_CASES) {
const result = fitBounds(testCase.width, testCase.height, testCase.bounds);
t.equal(Number.isFinite(result.latitude), true, 'got expected latitude');
t.equal(Number.isFinite(result.longitude), true, 'got expected latitude');
t.equal(Number.isFinite(result.zoom), true, 'got expected zoom');
}
t.end();
});