mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
replace missing round function in d3 to fix MapBox (#6444)
* replace missing round function in d3 * added unit test * fixed linting
This commit is contained in:
committed by
Maxime Beauchemin
parent
2931baa294
commit
71a713dcec
@@ -5,6 +5,7 @@ import {
|
||||
d3TimeFormatPreset,
|
||||
defaultNumberFormatter,
|
||||
mainMetric,
|
||||
roundDecimal,
|
||||
} from '../../../src/modules/utils';
|
||||
|
||||
describe('utils', () => {
|
||||
@@ -99,4 +100,11 @@ describe('utils', () => {
|
||||
expect(mainMetric(metrics)).toBe('foo');
|
||||
});
|
||||
});
|
||||
describe('roundDecimal', () => {
|
||||
it('rounding method to limit the number of decimal digits', () => {
|
||||
expect(roundDecimal(1.139, 2)).toBe(1.14);
|
||||
expect(roundDecimal(1.13929, 3)).toBe(1.139);
|
||||
expect(roundDecimal(1.13929)).toBe(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user