How to use the react-map-gl.fitBounds function in react-map-gl

To help you get started, we’ve selected a few react-map-gl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github uber / react-map-gl / test / utils / fit-bounds.spec.js View on Github external
test('fitBounds', (t) => {
  for (const [{viewport, bounds, options}, expected] of FITBOUNDS_TEST_CASES) {
    const result = fitBounds(viewport, bounds, options);

    t.ok(Number.isFinite(result.longitude), 'get valid longitude');
    t.ok(Number.isFinite(result.latitude), 'get valid latitude');
    t.ok(Number.isFinite(result.zoom), 'get valid zoom');
    t.deepEqual(
      toLowPrecision(result),
      toLowPrecision(expected),
      'valid viewport returned'
    );
  }
  t.end();
});