Skip to content

Commit

Permalink
itest: Checking the total num of payments
Browse files Browse the repository at this point in the history
When there are no payments expected returning, besides
checking if the paymensts is empty, check also if the
total num of payments is zero
  • Loading branch information
MPins committed Jul 10, 2024
1 parent fc41ecc commit 44987f4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions itest/lnd_payment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ func testListPayments(ht *lntest.HarnessTest) {
endDate: createTimeSeconds - 1,
expected: false,
},
{
// Use an earlier both start date and end date
// should return us nothing.
name: "earlier start and end date",
startDate: createTimeSeconds - 2,
endDate: createTimeSeconds - 1,
expected: false,
},
}
}

Expand All @@ -273,13 +281,19 @@ func testListPayments(ht *lntest.HarnessTest) {
req := &lnrpc.ListPaymentsRequest{
CreationDateStart: tc.startDate,
CreationDateEnd: tc.endDate,
CountTotalPayments: true,
}
resp := alice.RPC.ListPayments(req)

if tc.expected {
require.Lenf(t, resp.Payments, 1, "req=%v", req)
require.Equal(t, resp.TotalNumPayments,
uint64(1),
"TNP=%v", resp.TotalNumPayments)
} else {
require.Emptyf(t, resp.Payments, "req=%v", req)
require.Zero(t, resp.TotalNumPayments,
"TNP=%v", resp.TotalNumPayments)
}
})
}
Expand Down

0 comments on commit 44987f4

Please sign in to comment.