summaryrefslogtreecommitdiff
path: root/spec/frontend/lib/utils
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 18:08:05 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 18:08:05 +0000
commit184c2ced0761bd8dd7032619d16d3983fed7944a (patch)
treecc82b32ee7c1797509da3cf384617e4ffa2e1733 /spec/frontend/lib/utils
parent238d22c07218adf2b8f3db630ee8b74ca6f29df5 (diff)
downloadgitlab-ce-184c2ced0761bd8dd7032619d16d3983fed7944a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib/utils')
-rw-r--r--spec/frontend/lib/utils/set_spec.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/frontend/lib/utils/set_spec.js b/spec/frontend/lib/utils/set_spec.js
new file mode 100644
index 00000000000..7636a1c634c
--- /dev/null
+++ b/spec/frontend/lib/utils/set_spec.js
@@ -0,0 +1,19 @@
+import { isSubset } from '~/lib/utils/set';
+
+describe('utils/set', () => {
+ describe('isSubset', () => {
+ it.each`
+ subset | superset | expected
+ ${new Set()} | ${new Set()} | ${true}
+ ${new Set()} | ${new Set([1])} | ${true}
+ ${new Set([1])} | ${new Set([1])} | ${true}
+ ${new Set([1, 3])} | ${new Set([1, 2, 3])} | ${true}
+ ${new Set([1])} | ${new Set()} | ${false}
+ ${new Set([1])} | ${new Set([2])} | ${false}
+ ${new Set([7, 8, 9])} | ${new Set([1, 2, 3])} | ${false}
+ ${new Set([1, 2, 3, 4])} | ${new Set([1, 2, 3])} | ${false}
+ `('isSubset($subset, $superset) === $expected', ({ subset, superset, expected }) => {
+ expect(isSubset(subset, superset)).toBe(expected);
+ });
+ });
+});