mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +00:00
LibJS: Implement Set.prototype.difference
This commit is contained in:
parent
9e693304ff
commit
be8329d5f6
4 changed files with 84 additions and 0 deletions
|
@ -0,0 +1,12 @@
|
|||
test("basic functionality", () => {
|
||||
expect(Set.prototype.difference).toHaveLength(1);
|
||||
|
||||
const set1 = new Set(["a", "b", "c"]);
|
||||
const set2 = new Set(["b", "c", "d", "e"]);
|
||||
const difference1to2 = set1.difference(set2);
|
||||
expect(difference1to2).toHaveSize(1);
|
||||
expect(difference1to2.has("a")).toBeTrue();
|
||||
const difference2to1 = set2.difference(set1);
|
||||
expect(difference2to1).toHaveSize(2);
|
||||
["d", "e"].forEach(value => expect(difference2to1.has(value)).toBeTrue());
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue