-
Notifications
You must be signed in to change notification settings - Fork 0
/
solution.js
38 lines (27 loc) · 870 Bytes
/
solution.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// 70: Set - clear (solution)
// To do: make all tests pass, leave the assert lines unchanged!
describe('`clear()` removes all elements from a Set object.', function(){
let set;
beforeEach(() => set = new Set());
it('`set.size` becomes 0', function() {
set.add('one').add(2);
set.clear();
var expectedSize = 0;
assert.equal(set.size, expectedSize);
});
it('the iterator `set.entries()` will not contain any items', function() {
set.add('one').add(2);
set.clear();
const {done} = set.entries().next();
assert.equal(done, true);
});
it('any call to `set.has()` returns false', function() {
set.add('one').add(2);
set.clear();
assert.deepEqual(set.has(2), false);
});
it('returns `undefined`', function() {
var expectedReturn = undefined;
assert.equal(set.clear(), expectedReturn);
});
});