import { expect } from "chai" ; import { encodePico } from "../lib/encode-pico" ; describe ( "encode-pico" , ( ) => { const tests = [ [ "10" , "10p" ] , [ "100" , "100p" ] , [ "1000" , "1n" ] , [ "10000" , "10n" ] , [ "100000" , "100n" ] , [ "1000000" , "1u" ] , [ "10000000" , "10u" ] , [ "100000000" , "100u" ] , [ "1000000000" , "1m" ] , [ "10000000000" , "10m" ] , [ "100000000000" , "100m" ] , [ "1000000000000" , "1" ] , [ "10000000000000" , "10" ] , [ "100000000000000" , "100" ] , [ "2500000000" , "2500u" ] , [ "1002500000000" , "1002500u" ] , [ "1000200501000" , "1000200501n" ] , [ "1123412341230" , "1123412341230p" ] , ] ; for ( const [ input , expected ] of tests ) { it ( `encode amount ${ input } to ${ expected }` , ( ) => { expect ( encodePico ( input ) ) . to . equal ( expected ) ; } ) ; } it ( "should throw if attempts to encode 0" , ( ) => { expect ( ( ) => encodePico ( "0" ) ) . to . throw ( ) ; } ) ; } ) ;