@@ -68,6 +68,27 @@ describe('UnionIterator', () => {
6868 ( await toArray ( iterator ) ) . sort ( ) . should . eql ( [ 0 , 1 , 2 ] ) ;
6969 } ) ;
7070
71+ it ( 'should include all data from 0 sources - with maxParallelIterators: 1' , async ( ) => {
72+ const iterator = new UnionIterator ( [
73+ ] , { maxParallelIterators : 1 } ) ;
74+ ( await toArray ( iterator ) ) . sort ( ) . should . eql ( [ ] ) ;
75+ } ) ;
76+
77+ it ( 'should include all data from 1 non-empty source - with maxParallelIterators: 1' , async ( ) => {
78+ const iterator = new UnionIterator ( [
79+ range ( 0 , 2 ) ,
80+ ] , { maxParallelIterators : 1 } ) ;
81+ ( await toArray ( iterator ) ) . sort ( ) . should . eql ( [ 0 , 1 , 2 ] ) ;
82+ } ) ;
83+
84+ it ( 'should include all data from 2 non-empty sources - with maxParallelIterators: 1' , async ( ) => {
85+ const iterator = new UnionIterator ( [
86+ range ( 0 , 2 ) ,
87+ range ( 3 , 4 ) ,
88+ ] , { maxParallelIterators : 1 } ) ;
89+ ( await toArray ( iterator ) ) . sort ( ) . should . eql ( [ 0 , 1 , 2 , 3 , 4 ] ) ;
90+ } ) ;
91+
7192 it ( 'should include all data from 1 non-empty and 4 empty sources - with maxParallelIterators: 1' , async ( ) => {
7293 const iterator = new UnionIterator ( [
7394 new EmptyIterator ( ) ,
@@ -79,6 +100,23 @@ describe('UnionIterator', () => {
79100 ( await toArray ( iterator ) ) . sort ( ) . should . eql ( [ 0 , 1 , 2 ] ) ;
80101 } ) ;
81102
103+ it ( 'should include all data from 4 empty sources - with maxParallelIterators: 1' , async ( ) => {
104+ const iterator = new UnionIterator ( [
105+ new EmptyIterator ( ) ,
106+ new EmptyIterator ( ) ,
107+ new EmptyIterator ( ) ,
108+ new EmptyIterator ( ) ,
109+ ] , { maxParallelIterators : 1 } ) ;
110+ ( await toArray ( iterator ) ) . sort ( ) . should . eql ( [ ] ) ;
111+ } ) ;
112+
113+ it ( 'should include all data from 1 empty source - with maxParallelIterators: 1' , async ( ) => {
114+ const iterator = new UnionIterator ( [
115+ new EmptyIterator ( ) ,
116+ ] , { maxParallelIterators : 1 } ) ;
117+ ( await toArray ( iterator ) ) . sort ( ) . should . eql ( [ ] ) ;
118+ } ) ;
119+
82120 describe ( 'when constructed with an array of 0 sources' , ( ) => {
83121 let iterator ;
84122 before ( ( ) => {
0 commit comments