-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkata.js
32 lines (22 loc) · 807 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
// 41: array - entries
// To do: make all tests pass, leave the assert lines unchanged!
describe('`[].entries()` returns an iterator object with all entries', function() {
it('returns key+value for each element', function() {
const arr = ['a', 'b', 'c'];
const entriesAsArray = Array.from(arr.___());
assert.deepEqual(entriesAsArray, [[0,"a"], [1,"b"], [2,"c"]]);
});
it('empty elements contain the value `undefined`', function() {
const arr = ['one'];
arr[2] = 'three';
const secondValue = arr.entries();
assert.deepEqual(secondValue, [1, void 0]);
});
describe('returns an iterable', function() {
it('has `next()` to iterate', function() {
const arr = ['one'];
const value = arr;
assert.deepEqual(value, [0, 'one']);
});
});
});