import { Test , describe , given , it } from '@typed/test' ; import { apply } from './apply' ; const add = ( x , y ) => x + y ; export const test = describe ( `apply` , [ given ( `a list of arguments and a function` , [ it ( `calls the function with given arguments` , ( { equal } ) => { const argumentArray = [ 1 , 2 , 3 ] ; const expected = argumentArray . reduce ( add , 0 ) ; function f ( x , y , z ) { equal ( argumentArray , [ x , y , z ] ) ; return x + y + z ; } equal ( expected , apply ( argumentArray , f ) ) ; } ) , ] ) , ] ) ;