mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
improve test
This commit is contained in:
parent
0819df3d26
commit
d334eed9bb
@ -761,7 +761,7 @@ namespace BTCPayServer.Tests
|
||||
await user.GrantAccessAsync();
|
||||
await user.RegisterDerivationSchemeAsync("BTC");
|
||||
await user.RegisterLightningNodeAsync("BTC", LightningConnectionType.CLightning);
|
||||
|
||||
user.SetNetworkFeeMode(NetworkFeeMode.Never);
|
||||
var invoice = await user.BitPay.CreateInvoiceAsync(new Invoice(0.01m, "BTC"));
|
||||
await tester.WaitForEvent<InvoiceNewAddressEvent>(async () =>
|
||||
{
|
||||
@ -769,9 +769,27 @@ namespace BTCPayServer.Tests
|
||||
BitcoinAddress.Create(invoice.BitcoinAddress, Network.RegTest), Money.Coins(0.005m));
|
||||
});
|
||||
|
||||
var localInvoice = await user.BitPay.GetInvoiceAsync(invoice.Id);
|
||||
Assert.NotEqual(invoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11,
|
||||
localInvoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11);
|
||||
var newInvoice = await user.BitPay.GetInvoiceAsync(invoice.Id);
|
||||
var newBolt11 = newInvoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11;
|
||||
var oldBolt11= invoice.CryptoInfo.First(o => o.PaymentUrls.BOLT11 != null).PaymentUrls.BOLT11;
|
||||
Assert.NotEqual(newBolt11,oldBolt11);
|
||||
Assert.Equal(newInvoice.BtcDue.GetValue(), BOLT11PaymentRequest.Parse(newBolt11, Network.RegTest).MinimumAmount.ToDecimal(LightMoneyUnit.BTC));
|
||||
var evt = await tester.WaitForEvent<InvoiceDataChangedEvent>(async () =>
|
||||
{
|
||||
await tester.SendLightningPaymentAsync(newInvoice);
|
||||
});
|
||||
Assert.Equal(evt.InvoiceId, invoice.Id);
|
||||
Assert.Equal(InvoiceStatus.Complete, evt.State.Status);
|
||||
Assert.Equal(InvoiceExceptionStatus.None, evt.State.ExceptionStatus);
|
||||
|
||||
evt = await tester.WaitForEvent<InvoiceDataChangedEvent>(async () =>
|
||||
{
|
||||
await tester.SendLightningPaymentAsync(invoice);
|
||||
});
|
||||
|
||||
Assert.Equal(evt.InvoiceId, invoice.Id);
|
||||
Assert.Equal(InvoiceStatus.Invalid, evt.State.Status);
|
||||
Assert.Equal(InvoiceExceptionStatus.PaidOver, evt.State.ExceptionStatus);
|
||||
}
|
||||
|
||||
[Fact(Timeout = 60 * 2 * 1000)]
|
||||
|
Loading…
Reference in New Issue
Block a user