Skip to content

Commit f145f9c

Browse files
committed
Add tests
1 parent 64ddcb6 commit f145f9c

File tree

1 file changed

+51
-0
lines changed
  • lib/node_modules/@stdlib/iter/shift/test

1 file changed

+51
-0
lines changed

lib/node_modules/@stdlib/iter/shift/test/test.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,57 @@ tape( 'the function returns an iterator protocol-compliant object (value+done)',
394394
t.end();
395395
});
396396

397+
tape( 'the function returns an iterator protocol-compliant object (value+done; single element iterator)', function test( t ) {
398+
var expected;
399+
var values;
400+
var actual;
401+
var it;
402+
var i;
403+
404+
values = [ 1 ];
405+
expected = [
406+
{
407+
'done': true
408+
}
409+
];
410+
411+
it = iterShift( createIterator( values ) );
412+
t.equal( it.next.length, 0, 'has zero arity' );
413+
414+
actual = [];
415+
for ( i = 0; i < expected.length; i++ ) {
416+
actual.push( it.next() );
417+
}
418+
t.deepEqual( actual, expected, 'returns expected values' );
419+
t.end();
420+
});
421+
422+
tape( 'the function returns an iterator protocol-compliant object (value+done; two element iterator)', function test( t ) {
423+
var expected;
424+
var values;
425+
var actual;
426+
var it;
427+
var i;
428+
429+
values = [ 1, 2 ];
430+
expected = [
431+
{
432+
'value': 2,
433+
'done': true
434+
}
435+
];
436+
437+
it = iterShift( createIterator( values ) );
438+
t.equal( it.next.length, 0, 'has zero arity' );
439+
440+
actual = [];
441+
for ( i = 0; i < expected.length; i++ ) {
442+
actual.push( it.next() );
443+
}
444+
t.deepEqual( actual, expected, 'returns expected values' );
445+
t.end();
446+
});
447+
397448
tape( 'the function returns an iterator protocol-compliant object (value+done; callback)', function test( t ) {
398449
var expected;
399450
var values;

0 commit comments

Comments
 (0)