diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2019-03-01 13:22:46 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-03-01 14:27:39 +0300 |
commit | 700ae637d20a4c4f5754046e0f3a7bdb8931358b (patch) | |
tree | 0a20f0fe1aaca41d493d9b7994c57361bfd89bac /spec/javascripts/lib | |
parent | 31353188f84bd3e57318b4b1aa2da93a9d9605d1 (diff) |
Moves utility function into CE
Diffstat (limited to 'spec/javascripts/lib')
-rw-r--r-- | spec/javascripts/lib/utils/number_utility_spec.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/javascripts/lib/utils/number_utility_spec.js b/spec/javascripts/lib/utils/number_utility_spec.js index 94c6214c86a..818404bad81 100644 --- a/spec/javascripts/lib/utils/number_utility_spec.js +++ b/spec/javascripts/lib/utils/number_utility_spec.js @@ -4,6 +4,7 @@ import { bytesToMiB, bytesToGiB, numberToHumanSize, + sum, } from '~/lib/utils/number_utils'; describe('Number Utils', () => { @@ -87,4 +88,14 @@ describe('Number Utils', () => { expect(numberToHumanSize(10737418240)).toEqual('10.00 GiB'); }); }); + + describe('sum', () => { + it('should add up two values', () => { + expect(sum(1, 2)).toEqual(3); + }); + + it('should add up all the values in an array when passed to a reducer', () => { + expect([1, 2, 3, 4, 5].reduce(sum)).toEqual(15); + }); + }); }); |