import * as tape from 'tape' ; import flatten from '../../src/utils/flatten' ; tape . test ( 'flatten' , t => { t . deepEqual ( flatten ( [ 'foo' , [ 'bar' , 'foo' , [ 'hello' , 'world' ] ] , 'bar' ] ) , [ 'foo' , 'bar' , 'foo' , 'hello' , 'world' , 'bar' ] , 'it should flatten array' ) ; const arrResult = [ 'hello' ] ; t . equal ( flatten ( [ 'foo' , [ 'bar' , 'foo' ] ] , arrResult ) , arrResult , 'it should reuse the result array passed as second parameter if provided' ) ; t . deepEqual ( arrResult , [ 'hello' , 'foo' , 'bar' , 'foo' ] , 'it should fill the given array' ) ; t . end ( ) ; } ) ;