import test from 'unit.js' ; import { ModelMapper } from '../mapper' ; const stringify = ModelMapper < number , string , Partial < { multiplier : number ; } > > ( ( from , options ) => { const { multiplier = 1 } = options ?? { } ; return `${ from * multiplier }` ; } ) ; describe ( 'Test CreateModelMapper' , ( ) => { it ( 'Without Options' , done => { test . value ( stringify . map ( 1 ) ) . is ( '1' ) ; test . value ( [ 1 , 2 ] . map ( stringify . mapper ( ) ) ) . is ( [ '1' , '2' ] ) ; done ( ) ; } ) ; it ( 'With Options' , done => { test . value ( stringify . map ( 1 , { multiplier : 2 } ) ) . is ( '2' ) ; test . value ( [ 1 , 2 ] . map ( stringify . mapper ( { multiplier : 2 } ) ) ) . is ( [ '2' , '4' ] ) ; done ( ) ; } ) ; } ) ;