import { A , pipe } from '../..' ; describe ( 'flat' , ( ) => { it ( 'flattens an array correctly' , ( ) => { const result = A . flat ( [ [ 1 , 2 ] , 3 , [ 4 , 5 ] ] ) ; expect ( result ) . toEqual ( [ 1 , 2 , 3 , 4 , 5 ] ) ; } ) ; it ( 'flattens nested arrays' , ( ) => { const result = A . flat ( [ [ 1 , 2 ] , [ [ 3 ] , [ 4 , 5 ] ] , ] ) ; expect ( result ) . toEqual ( [ 1 , 2 , [ 3 ] , [ 4 , 5 ] ] ) ; } ) ; it ( 'flattens a single value' , ( ) => { const result = A . flat ( [ [ 1 ] ] ) ; expect ( result ) . toEqual ( [ 1 ] ) ; } ) ; } ) ; describe ( 'flat (pipe)' , ( ) => { it ( 'flattens an array correctly' , ( ) => { const result = pipe ( [ [ 1 , 2 ] , 3 , [ 4 , 5 ] ] , A . flat ) ; expect ( result ) . toEqual ( [ 1 , 2 , 3 , 4 , 5 ] ) ; } ) ; it ( 'flattens nested arrays' , ( ) => { const result = pipe ( [ [ 1 , 2 ] , [ [ 3 ] , [ 4 , 5 ] ] , ] , A . flat ) ; expect ( result ) . toEqual ( [ 1 , 2 , [ 3 ] , [ 4 , 5 ] ] ) ; } ) ; it ( 'flattens a single value' , ( ) => { const result = pipe ( [ [ 1 ] ] , A . flat ) ; expect ( result ) . toEqual ( [ 1 ] ) ; } ) ; } ) ;