diff options
author | Revanshu Paliwal <revanshu.paliwal@sonarsource.com> | 2022-11-02 14:02:01 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-11-04 20:03:11 +0000 |
commit | 0be0c1cc73b4012b82314713d17d1fc812c7e4d4 (patch) | |
tree | 9441b843a9b267b4330e426ea38c8d203bc7b011 /server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts | |
parent | 2d7a0bea6d4ddef640f395da615abe4c92a36b2c (diff) | |
download | sonarqube-0be0c1cc73b4012b82314713d17d1fc812c7e4d4.tar.gz sonarqube-0be0c1cc73b4012b82314713d17d1fc812c7e4d4.zip |
SONAR-17553 Removing getMinDecimalsCountToBeDistinctFromThreshold as its not used anywhere
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts index 2c7d78e0dd4..2f90fc1cb58 100644 --- a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts +++ b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts @@ -20,12 +20,7 @@ import { Dict } from '../../types/types'; import { getMessages } from '../l10nBundle'; -import { - enhanceConditionWithMeasure, - formatMeasure, - getMinDecimalsCountToBeDistinctFromThreshold, - isPeriodBestValue, -} from '../measures'; +import { enhanceConditionWithMeasure, formatMeasure, isPeriodBestValue } from '../measures'; import { mockQualityGateStatusCondition } from '../mocks/quality-gates'; import { mockMeasureEnhanced, mockMetric } from '../testMocks'; @@ -250,38 +245,3 @@ describe('#formatMeasure()', () => { expect(formatMeasure(undefined, 'INT')).toBe(''); }); }); - -describe('getMinDecimalsCountToBeDistinctFromThreshold', () => { - it('should return default if no threshold', () => { - expect(getMinDecimalsCountToBeDistinctFromThreshold(2.67, undefined)).toBe(1); - }); - - it('should return 1 if delta is 0', () => { - expect(getMinDecimalsCountToBeDistinctFromThreshold(2.5, 2.5)).toBe(1); - }); - - it('should return 1 if the delta is larger than 0.1', () => { - [0.1, 0.15, 0.2, 0.5, 0.8, 1].forEach((delta) => { - expect(getMinDecimalsCountToBeDistinctFromThreshold(2.5 + delta, 2.5)).toBe(1); - expect(getMinDecimalsCountToBeDistinctFromThreshold(2.5 - delta, 2.5)).toBe(1); - }); - }); - - it('should return enough precision to see the delta', () => { - expect(getMinDecimalsCountToBeDistinctFromThreshold(2.55, 2.5)).toBe(2); - expect(getMinDecimalsCountToBeDistinctFromThreshold(2.505, 2.5)).toBe(3); - expect(getMinDecimalsCountToBeDistinctFromThreshold(2.5005, 2.5)).toBe(4); - expect(getMinDecimalsCountToBeDistinctFromThreshold(85.01, 85)).toBe(2); - expect(getMinDecimalsCountToBeDistinctFromThreshold(84.95, 85)).toBe(2); - // eslint-disable-next-line no-loss-of-precision - expect(getMinDecimalsCountToBeDistinctFromThreshold(84.999999999999554, 85)).toBe( - '9999999999995'.length - ); - // eslint-disable-next-line no-loss-of-precision - expect(getMinDecimalsCountToBeDistinctFromThreshold(85.0000000000000954, 85)).toBe( - '00000000000009'.length - ); - // eslint-disable-next-line no-loss-of-precision - expect(getMinDecimalsCountToBeDistinctFromThreshold(85.00000000000000009, 85)).toBe(1); - }); -}); |