diff --git a/src/components/Core/SpeedCard.vue b/src/components/Core/SpeedCard.vue index aaf4f9e73b..6866db435a 100644 --- a/src/components/Core/SpeedCard.vue +++ b/src/components/Core/SpeedCard.vue @@ -35,7 +35,7 @@ export default { getSpeedValue(value) { if (!value) return '0' const c = 1024 - const d = value > 1048576 ? 2 : 0 // 2 decimals when MB + const d = value > 1048576 ? 1 : 0 // 2 decimals when MB const f = Math.floor(Math.log(value) / Math.log(c)) return `${parseFloat((value / Math.pow(c, f)).toFixed(d))}` @@ -50,4 +50,4 @@ export default { padding: 32px 16px !important; font-size: 1.05em; } - \ No newline at end of file + diff --git a/tests/unit/SpeedCard.spec.js b/tests/unit/SpeedCard.spec.js index d9a99b692c..bf2debd802 100644 --- a/tests/unit/SpeedCard.spec.js +++ b/tests/unit/SpeedCard.spec.js @@ -34,10 +34,10 @@ describe('SpeedCard.vue', () => { expect(wrapper.find('[data-testid="SpeedCard-unit"]').text()).toBe('KB/s') }) - it('should render value (2 decimals) and unit & be formatted', () => { + it('should render value (1 decimals) and unit & be formatted', () => { const wrapper = setup(SpeedCard, { value: 10899700 }) - expect(wrapper.find('[data-testid="SpeedCard-value"]').text()).toBe('10.39') + expect(wrapper.find('[data-testid="SpeedCard-value"]').text()).toBe('10.4') expect(wrapper.find('[data-testid="SpeedCard-unit"]').text()).toBe('MB/s') }) -}) \ No newline at end of file +})