From 60cbbf7535bc073f71ac61796a86a4d2a146acac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz=20K=C4=B1l=C4=B1=C3=A7?= Date: Wed, 6 Feb 2019 14:05:56 +0300 Subject: [PATCH] fix(test): updated tests and docs --- docs/index.md | 2 +- test/superset.spec.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/index.md b/docs/index.md index 7203b98..c5b9a2b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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 diff --git a/test/superset.spec.js b/test/superset.spec.js index f4cf20a..f016561 100644 --- a/test/superset.spec.js +++ b/test/superset.spec.js @@ -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]); + }); }); });