diff options
Diffstat (limited to 'spec/frontend/lib/utils/array_utility_spec.js')
-rw-r--r-- | spec/frontend/lib/utils/array_utility_spec.js | 13 |
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); + }); + }); }); |