From 3a50ce0397239c23669e17ec74d06e577da87fc4 Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Fri, 17 May 2024 14:16:37 +0100 Subject: [PATCH] test_: Added testing for filterNetworkComplianceV2 --- services/wallet/router/filter_test.go | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/services/wallet/router/filter_test.go b/services/wallet/router/filter_test.go index 591f02a3a..aca02f6cb 100644 --- a/services/wallet/router/filter_test.go +++ b/services/wallet/router/filter_test.go @@ -201,3 +201,31 @@ func TestHasSufficientCapacityV2(t *testing.T) { }) } } + +func TestFilterNetworkComplianceV2(t *testing.T) { + fromLockedAmount := map[uint64]*hexutil.Big{ + 1: (*hexutil.Big)(big.NewInt(100)), + 2: (*hexutil.Big)(big.NewInt(0)), + } + + routes := [][]*PathV2{ + { + {From: ¶ms.Network{ChainID: 1}}, + {From: ¶ms.Network{ChainID: 3}}, + }, + { + {From: ¶ms.Network{ChainID: 2}}, + {From: ¶ms.Network{ChainID: 3}}, + }, + } + + expectedRoutes := [][]*PathV2{ + { + {From: ¶ms.Network{ChainID: 1}}, + {From: ¶ms.Network{ChainID: 3}}, + }, + } + + filteredRoutes := filterNetworkComplianceV2(routes, fromLockedAmount) + assert.Equal(t, expectedRoutes, filteredRoutes) +}