paych: Fix cli tests

This commit is contained in:
Łukasz Magiera 2022-01-05 12:11:19 +01:00
parent eab8fecd26
commit 533349cc0d
2 changed files with 5 additions and 5 deletions

View File

@ -193,11 +193,11 @@ func paychStatus(writer io.Writer, avail *api.ChannelAvailableFunds) {
{"From", avail.From.String()}, {"From", avail.From.String()},
{"To", avail.To.String()}, {"To", avail.To.String()},
{"Confirmed Amt", fmt.Sprintf("%s", types.FIL(avail.ConfirmedAmt))}, {"Confirmed Amt", fmt.Sprintf("%s", types.FIL(avail.ConfirmedAmt))},
{"Pending Amt", fmt.Sprintf("%s", types.FIL(avail.PendingAmt))},
{"Available Amt", fmt.Sprintf("%s", types.FIL(avail.AvailableAmt))}, {"Available Amt", fmt.Sprintf("%s", types.FIL(avail.AvailableAmt))},
{"Voucher Redeemed Amt", fmt.Sprintf("%s", types.FIL(avail.VoucherReedeemedAmt))},
{"Pending Amt", fmt.Sprintf("%s", types.FIL(avail.PendingAmt))},
{"Pending Available Amt", fmt.Sprintf("%s", types.FIL(avail.PendingAvailableAmt))}, {"Pending Available Amt", fmt.Sprintf("%s", types.FIL(avail.PendingAvailableAmt))},
{"Queued Amt", fmt.Sprintf("%s", types.FIL(avail.QueuedAmt))}, {"Queued Amt", fmt.Sprintf("%s", types.FIL(avail.QueuedAmt))},
{"Voucher Redeemed Amt", fmt.Sprintf("%s", types.FIL(avail.VoucherReedeemedAmt))},
} }
if avail.PendingWaitSentinel != nil { if avail.PendingWaitSentinel != nil {
nameValues = append(nameValues, []string{ nameValues = append(nameValues, []string{

View File

@ -133,10 +133,10 @@ func TestPaymentChannelStatus(t *testing.T) {
require.True(t, stateCreating || stateCreated) require.True(t, stateCreating || stateCreated)
channelAmtAtto := types.BigMul(types.NewInt(channelAmt), types.NewInt(build.FilecoinPrecision)) channelAmtAtto := types.BigMul(types.NewInt(channelAmt), types.NewInt(build.FilecoinPrecision))
channelAmtStr := fmt.Sprintf("%d", channelAmtAtto) channelAmtStr := fmt.Sprintf("%s", types.FIL(channelAmtAtto))
if stateCreating { if stateCreating {
// If we're in the creating state (most likely) the amount should be pending // If we're in the creating state (most likely) the amount should be pending
require.Regexp(t, regexp.MustCompile("Pending.*"+channelAmtStr), out) require.Regexp(t, regexp.MustCompile("Pending Amt.*"+channelAmtStr), out)
} }
// Wait for create channel to complete // Wait for create channel to complete
@ -159,7 +159,7 @@ func TestPaymentChannelStatus(t *testing.T) {
out = creatorCLI.RunCmd("paych", "status", chstr) out = creatorCLI.RunCmd("paych", "status", chstr)
fmt.Println(out) fmt.Println(out)
voucherAmtAtto := types.BigMul(types.NewInt(voucherAmt), types.NewInt(build.FilecoinPrecision)) voucherAmtAtto := types.BigMul(types.NewInt(voucherAmt), types.NewInt(build.FilecoinPrecision))
voucherAmtStr := fmt.Sprintf("%d", voucherAmtAtto) voucherAmtStr := fmt.Sprintf("%s", types.FIL(voucherAmtAtto))
// Output should include voucher amount // Output should include voucher amount
require.Regexp(t, regexp.MustCompile("Voucher.*"+voucherAmtStr), out) require.Regexp(t, regexp.MustCompile("Voucher.*"+voucherAmtStr), out)
} }