Skip to content

Commit

Permalink
fix(test): updated tests and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzzkilic committed Feb 6, 2019
1 parent bbfffaf commit 60cbbf7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ nums.update([2, 4, 6]); // → SuperSet { 0, 1, 2, 4, 6 }

## `discard(iterable)`

The discard() method deletes the iterable elements from the set and return the updated elements.
The discard() method deletes the iterable elements from the data set and returns the updated elements.

### Example

Expand Down
14 changes: 14 additions & 0 deletions test/superset.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,19 @@ describe("SuperSet", () => {

expect(Array.from(result)).to.eql([2]);
});

it("should delete undefined elements and return updated elements.", () => {
const result = testSet.discard([7]);

expect(Array.from(result)).to.eql([1, 2, 3]);
});

it("should delete again same elements in an iterable way and return current elements.", () => {
const result = testSet.discard([1]);
expect(Array.from(result)).to.eql([2, 3]);

const sameResult = testSet.discard([1]);
expect(Array.from(sameResult)).to.eql([2, 3]);
});
});
});

0 comments on commit 60cbbf7

Please sign in to comment.