import { expect } from 'chai' ; import { iter , retro , RetroArrayIterator , toArray } from '@lumino/algorithm' ; import { testIterator } from './iter.spec' ; describe ( '@lumino/algorithm' , ( ) => { describe ( 'retro()' , ( ) => { it ( 'should create an iterator for an array-like object' , ( ) => { expect ( toArray ( retro ( [ 0 , 1 , 2 , 3 ] ) ) ) . to . deep . equal ( [ 3 , 2 , 1 , 0 ] ) ; } ) ; it ( 'should call `retro` on a retroable' , ( ) => { let iterator = iter ( [ 1 , 2 , 3 , 4 ] ) ; let retroable = { retro : ( ) => iterator } ; expect ( retro ( retroable ) ) . to . equal ( iterator ) ; } ) ; } ) ; describe ( 'RetroArrayIterator' , ( ) => { testIterator ( ( ) => { return [ new RetroArrayIterator ( [ 1 , 2 , 3 ] ) , [ 3 , 2 , 1 ] ] ; } ) ; } ) ; } ) ;