From cc3b32c0d48ecdcabac3d6c1810d440517c1e8a8 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Wed, 6 Dec 2017 18:39:50 -0800 Subject: [PATCH] routing: extend TestFindRoutesFeeSorting to assert proper fee attributes --- routing/router_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/routing/router_test.go b/routing/router_test.go index 63632852..8568cbf2 100644 --- a/routing/router_test.go +++ b/routing/router_test.go @@ -175,10 +175,21 @@ func TestFindRoutesFeeSorting(t *testing.T) { // Exactly, two such paths should be found. if len(routes) != 2 { - t.Fatalf("2 routes shouldn't been selected, instead %v were: %v", + t.Fatalf("2 routes should've been selected, instead %v were: %v", len(routes), spew.Sdump(routes)) } + // We shouldn't pay a fee for the fist route, but the second route + // should have a fee intact. + if routes[0].TotalFees != 0 { + t.Fatalf("incorrect fees for first route, expected 0 got: %v", + routes[0].TotalFees) + } + if routes[1].TotalFees == 0 { + t.Fatalf("total fees not set in second route: ", + spew.Sdump(routes[0])) + } + // The paths should properly be ranked according to their total fee // rate. if routes[0].TotalFees > routes[1].TotalFees {