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:
Diffstat (limited to 'spec/frontend/lib/utils/array_utility_spec.js')
-rw-r--r--spec/frontend/lib/utils/array_utility_spec.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/array_utility_spec.js b/spec/frontend/lib/utils/array_utility_spec.js
index b95286ff254..64ddd400114 100644
--- a/spec/frontend/lib/utils/array_utility_spec.js
+++ b/spec/frontend/lib/utils/array_utility_spec.js
@@ -29,4 +29,17 @@ describe('array_utility', () => {
},
);
});
+
+ describe('getDuplicateItemsFromArray', () => {
+ it.each`
+ array | result
+ ${[]} | ${[]}
+ ${[1, 2, 2, 3, 3, 4]} | ${[2, 3]}
+ ${[1, 2, 3, 2, 3, 4]} | ${[2, 3]}
+ ${['foo', 'bar', 'bar', 'foo', 'baz']} | ${['bar', 'foo']}
+ ${['foo', 'foo', 'bar', 'foo', 'bar']} | ${['foo', 'bar']}
+ `('given $array will return $result', ({ array, result }) => {
+ expect(arrayUtils.getDuplicateItemsFromArray(array)).toEqual(result);
+ });
+ });
});