-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
39 lines (33 loc) · 962 Bytes
/
test.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
39
'use strict';
let expect = require('expect.js')
let concat = require('./');
function* numbers() {
yield 1;
yield 2;
}
describe('concat-iterator', function(){
describe('two iterators', function(){
it('should yield the values twice', function(){
let two = concat(numbers(), numbers())
expect(two.next().value).to.be(1);
expect(two.next().value).to.be(2);
expect(two.next().value).to.be(1);
expect(two.next().value).to.be(2);
expect(two.next().done).to.be(true);
});
});
describe('zero case', function() {
it('should yield nothing', function(){
let zero = concat()
expect(zero.next().done).to.be(true);
});
})
describe('one case', function() {
it('should yield the values in the iterator', function(){
let one = concat(numbers())
expect(one.next().value).to.be(1);
expect(one.next().value).to.be(2);
expect(one.next().done).to.be(true);
})
})
});