import { getTotalTax } from "./Tx" ; import sample from "./logs.sample.json" ; const dummyTx = { id : 11 , height : "1234" , txhash : "" , raw_log : "" , logs : [ ] , gas_wanted : "12345" , gas_used : "12345" , tags : [ ] , tx : { type : "test" , value : { msg : [ ] , fee : { amount : [ ] , gas : "12345" } , signatures : [ ] , memo : "" } } , timestamp : new Date ( ) } ; describe ( "getTotalTax" , ( ) => { test ( `no tax` , ( ) => { expect ( getTotalTax ( { ... dummyTx , logs : sample [ "no tax" ] . logs } ) ) . toEqual ( "0 Luna" ) ; } ) ; test ( `single denom` , ( ) => { expect ( getTotalTax ( { ... dummyTx , logs : sample [ "single denom" ] . logs } ) ) . toEqual ( `308.477000 KRT` ) ; } ) ; test ( `multiple logs with single denom` , ( ) => { expect ( getTotalTax ( { ... dummyTx , logs : sample [ "multiple logs with single denom" ] . logs } ) ) . toEqual ( `0.000040 KRT` ) ; } ) ; test ( `multiple logs with multiple denoms` , ( ) => { expect ( getTotalTax ( { ... dummyTx , logs : sample [ "multiple logs with multiple denoms" ] . logs } ) ) . toEqual ( `0.000040 KRT, 0.000020 Luna, 0.000020 UST` ) ; } ) ; } ) ;