test_: Added testing for filterRoutesV2
This commit is contained in:
parent
a91ce6067d
commit
4f2cd8ff7a
|
@ -259,3 +259,33 @@ func TestFilterCapacityValidationV2(t *testing.T) {
|
||||||
filteredRoutes := filterCapacityValidationV2(routes, amountIn, fromLockedAmount)
|
filteredRoutes := filterCapacityValidationV2(routes, amountIn, fromLockedAmount)
|
||||||
assert.Equal(t, expectedRoutes, filteredRoutes)
|
assert.Equal(t, expectedRoutes, filteredRoutes)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestFilterRoutesV2(t *testing.T) {
|
||||||
|
fromLockedAmount := map[uint64]*hexutil.Big{
|
||||||
|
1: (*hexutil.Big)(big.NewInt(50)),
|
||||||
|
2: (*hexutil.Big)(big.NewInt(100)),
|
||||||
|
}
|
||||||
|
|
||||||
|
routes := [][]*PathV2{
|
||||||
|
{
|
||||||
|
{From: ¶ms.Network{ChainID: 1}, AmountIn: (*hexutil.Big)(big.NewInt(100))},
|
||||||
|
{From: ¶ms.Network{ChainID: 2}, AmountIn: (*hexutil.Big)(big.NewInt(200))},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{From: ¶ms.Network{ChainID: 3}, AmountIn: (*hexutil.Big)(big.NewInt(100))},
|
||||||
|
{From: ¶ms.Network{ChainID: 4}, AmountIn: (*hexutil.Big)(big.NewInt(50))},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
amountIn := big.NewInt(120)
|
||||||
|
|
||||||
|
expectedRoutes := [][]*PathV2{
|
||||||
|
{
|
||||||
|
{From: ¶ms.Network{ChainID: 1}, AmountIn: (*hexutil.Big)(big.NewInt(50)), AmountInLocked: true},
|
||||||
|
{From: ¶ms.Network{ChainID: 2}, AmountIn: (*hexutil.Big)(big.NewInt(200))},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
filteredRoutes := filterRoutesV2(routes, amountIn, fromLockedAmount)
|
||||||
|
assert.Equal(t, expectedRoutes, filteredRoutes)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue