Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 18:44:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-19 18:44:42 +0300
commit4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch)
tree5423a1c7516cffe36384133ade12572cf709398d /spec/frontend/lib/utils/number_utility_spec.js
parente570267f2f6b326480d284e0164a6464ba4081bc (diff)
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'spec/frontend/lib/utils/number_utility_spec.js')
-rw-r--r--spec/frontend/lib/utils/number_utility_spec.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/number_utility_spec.js b/spec/frontend/lib/utils/number_utility_spec.js
index 4dcd9211697..f4483f5098b 100644
--- a/spec/frontend/lib/utils/number_utility_spec.js
+++ b/spec/frontend/lib/utils/number_utility_spec.js
@@ -10,6 +10,7 @@ import {
changeInPercent,
formattedChangeInPercent,
isNumeric,
+ isPositiveInteger,
} from '~/lib/utils/number_utils';
describe('Number Utils', () => {
@@ -184,4 +185,29 @@ describe('Number Utils', () => {
expect(isNumeric(value)).toBe(outcome);
});
});
+
+ describe.each`
+ value | outcome
+ ${0} | ${true}
+ ${'0'} | ${true}
+ ${12345} | ${true}
+ ${'12345'} | ${true}
+ ${-1} | ${false}
+ ${'-1'} | ${false}
+ ${1.01} | ${false}
+ ${'1.01'} | ${false}
+ ${'abcd'} | ${false}
+ ${'100abcd'} | ${false}
+ ${'abcd100'} | ${false}
+ ${''} | ${false}
+ ${false} | ${false}
+ ${true} | ${false}
+ ${undefined} | ${false}
+ ${null} | ${false}
+ ${Infinity} | ${false}
+ `('isPositiveInteger', ({ value, outcome }) => {
+ it(`when called with ${typeof value} ${value} it returns ${outcome}`, () => {
+ expect(isPositiveInteger(value)).toBe(outcome);
+ });
+ });
});