@@ -9,7 +9,11 @@ import { mockAssetTransactions } from '../tests/mocks/mockAssetTransactions.js'
99import { PoolSnapshot } from '../queries/poolSnapshots.js'
1010import { Currency } from '../utils/BigInt.js'
1111import { PoolFeeSnapshot , PoolFeeSnapshotsByDate } from '../queries/poolFeeSnapshots.js'
12- import { ProfitAndLossReportPrivateCredit , ProfitAndLossReportPublicCredit } from './types.js'
12+ import {
13+ AssetTransactionReportFilter ,
14+ ProfitAndLossReportPrivateCredit ,
15+ ProfitAndLossReportPublicCredit ,
16+ } from './types.js'
1317import { InvestorTransaction } from '../queries/investorTransactions.js'
1418
1519describe ( 'Processor' , ( ) => {
@@ -477,6 +481,34 @@ describe('Processor', () => {
477481 } )
478482 expect ( result ) . to . have . lengthOf ( 3 )
479483 } )
484+ it ( 'should filter by assetId' , ( ) => {
485+ const result = processor . assetTransactions (
486+ {
487+ assetTransactions : mockAssetTransactions ,
488+ } ,
489+ { assetId : 'asset-1' }
490+ )
491+ expect ( result ) . to . have . lengthOf ( 2 )
492+ } )
493+ it ( 'should filter by transaction type' , ( ) => {
494+ const types : { type : AssetTransactionReportFilter [ 'transactionType' ] ; expected : number } [ ] = [
495+ { type : 'created' , expected : 0 } ,
496+ { type : 'financed' , expected : 1 } ,
497+ { type : 'repaid' , expected : 1 } ,
498+ { type : 'priced' , expected : 0 } ,
499+ { type : 'closed' , expected : 0 } ,
500+ { type : 'cashTransfer' , expected : 1 } ,
501+ ]
502+ for ( const { type, expected } of types ) {
503+ const result = processor . assetTransactions (
504+ {
505+ assetTransactions : mockAssetTransactions ,
506+ } ,
507+ { transactionType : type }
508+ )
509+ expect ( result ) . to . have . lengthOf ( expected )
510+ }
511+ } )
480512 } )
481513 describe ( 'applyGrouping' , ( ) => {
482514 const applyGrouping = processor [ 'applyGrouping' ]
0 commit comments