-
Notifications
You must be signed in to change notification settings - Fork 0
/
kata.js
38 lines (27 loc) · 744 Bytes
/
kata.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
// 48: Set - add
// To do: make all tests pass, leave the assert lines unchanged!
describe('`add()` appends a new element to the end of a Set object.', function(){
let set;
beforeEach(() => set = new Set());
it('adds every value, of any type, only once', function() {
const fn = () => {};
set.add(1);
set.add(1);
set.add(fn);
set.add({fn});
assert.equal(set.size, 2);
});
it('is chainable', function() {
set.add.add;
assert.equal(set.has(2), true);
});
it('call without params adds undefined', function() {
set.add
assert.equal(set.has(void 0), true);
});
it('0, -0 and +0 are equal', function() {
set.add();
set.add();
assert.equal(set.has(+0), true);
});
});