mirror of
https://github.com/apache/superset.git
synced 2026-04-13 13:18:25 +00:00
* [lint] turn no-undef back on, set browser, cypress, and mocha env's, and fix issues * [lint] fix undefined var in TimeTable.jsx
27 lines
853 B
JavaScript
27 lines
853 B
JavaScript
import { expect } from 'chai';
|
|
|
|
import { unitToRadius } from '../../../src/modules/geo';
|
|
|
|
const METER_TO_MILE = 1609.34;
|
|
|
|
describe('unitToRadius', () => {
|
|
it('converts to square meters', () => {
|
|
expect(unitToRadius('square_m', 4 * Math.PI)).to.equal(2);
|
|
});
|
|
it('converts to square meters', () => {
|
|
expect(unitToRadius('square_km', 25 * Math.PI)).to.equal(5000);
|
|
});
|
|
it('converts to radius meters', () => {
|
|
expect(unitToRadius('radius_m', 1000)).to.equal(1000);
|
|
});
|
|
it('converts to radius km', () => {
|
|
expect(unitToRadius('radius_km', 1)).to.equal(1000);
|
|
});
|
|
it('converts to radius miles', () => {
|
|
expect(unitToRadius('radius_miles', 1)).to.equal(METER_TO_MILE);
|
|
});
|
|
it('converts to square miles', () => {
|
|
expect(unitToRadius('square_miles', 25 * Math.PI)).to.equal(5000 * (METER_TO_MILE / 1000));
|
|
});
|
|
});
|