summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-12-01 22:44:04 +0200
committerLinus Groh <mail@linusgroh.de>2022-12-02 13:09:15 +0100
commite359eeabe88ab1d1c932eeab6b04824890e5492f (patch)
tree4f8482a680578148bff2cb9c0ea035fb99f84625 /Userland/Libraries/LibJS/Tests
parentbe8329d5f66a3386aec7e46c4592ad1f87dc9e48 (diff)
downloadserenity-e359eeabe88ab1d1c932eeab6b04824890e5492f.zip
LibJS: Implement Set.prototype.symmetricDifference
Diffstat (limited to 'Userland/Libraries/LibJS/Tests')
-rw-r--r--Userland/Libraries/LibJS/Tests/builtins/Set/Set.prototype.symmetricDifference.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/builtins/Set/Set.prototype.symmetricDifference.js b/Userland/Libraries/LibJS/Tests/builtins/Set/Set.prototype.symmetricDifference.js
new file mode 100644
index 0000000000..ef54b70b86
--- /dev/null
+++ b/Userland/Libraries/LibJS/Tests/builtins/Set/Set.prototype.symmetricDifference.js
@@ -0,0 +1,12 @@
+test("basic functionality", () => {
+ expect(Set.prototype.symmetricDifference).toHaveLength(1);
+
+ const set1 = new Set(["a", "b", "c"]);
+ const set2 = new Set(["b", "c", "d", "e"]);
+ const symmetricDifference1to2 = set1.symmetricDifference(set2);
+ const symmetricDifference2to1 = set2.symmetricDifference(set1);
+ for (const symmetricDifferenceSet of [symmetricDifference1to2, symmetricDifference2to1]) {
+ expect(symmetricDifferenceSet).toHaveSize(3);
+ ["a", "d", "e"].forEach(value => expect(symmetricDifferenceSet.has(value)).toBeTrue());
+ }
+});