mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
Fix flaky tests (#5934)
This commit is contained in:
parent
76719cdc4a
commit
bd978f29a0
2 changed files with 9 additions and 10 deletions
|
@ -310,6 +310,7 @@ namespace BTCPayServer.Tests
|
|||
{
|
||||
invoice = user.BitPay.GetInvoice(invoice.Id);
|
||||
Assert.Equal(firstPayment, invoice.CryptoInfo[0].Paid);
|
||||
Assert.Equal("paidPartial", invoice.ExceptionStatus?.ToString());
|
||||
});
|
||||
|
||||
Assert.Single(invoice.CryptoInfo); // Only BTC should be presented
|
||||
|
|
|
@ -1982,29 +1982,27 @@ namespace BTCPayServer.Tests
|
|||
.PaymentLink, tester.ExplorerNode.Network);
|
||||
var halfPaymentTx = await tester.ExplorerNode.SendToAddressAsync(invoicePaymentRequest.Address, Money.Coins(invoicePaymentRequest.Amount.ToDecimal(MoneyUnit.BTC)/2m));
|
||||
|
||||
invoicePaymentRequest = new BitcoinUrlBuilder((await client.GetInvoicePaymentMethods(user.StoreId, invoice.Id)).Single(model =>
|
||||
PaymentMethodId.Parse(model.PaymentMethodId) ==
|
||||
PaymentTypes.CHAIN.GetPaymentMethodId("BTC"))
|
||||
.PaymentLink, tester.ExplorerNode.Network);
|
||||
var remainingPaymentTx = await tester.ExplorerNode.SendToAddressAsync(invoicePaymentRequest.Address, Money.Coins(invoicePaymentRequest.Amount.ToDecimal(MoneyUnit.BTC)));
|
||||
|
||||
await user.AssertHasWebhookEvent(WebhookEventType.InvoiceCreated, (WebhookInvoiceEvent x)=> Assert.Equal(invoice.Id, x.InvoiceId));
|
||||
await user.AssertHasWebhookEvent(WebhookEventType.InvoiceProcessing, (WebhookInvoiceEvent x)=> Assert.Equal(invoice.Id, x.InvoiceId));
|
||||
await user.AssertHasWebhookEvent(WebhookEventType.InvoiceReceivedPayment,
|
||||
(WebhookInvoiceReceivedPaymentEvent x) =>
|
||||
{
|
||||
Assert.Equal(invoice.Id, x.InvoiceId);
|
||||
Assert.Contains(halfPaymentTx.ToString(), x.Payment.Id);
|
||||
});
|
||||
await user.AssertHasWebhookEvent(WebhookEventType.InvoiceReceivedPayment,
|
||||
invoicePaymentRequest = new BitcoinUrlBuilder((await client.GetInvoicePaymentMethods(user.StoreId, invoice.Id)).Single(model =>
|
||||
PaymentMethodId.Parse(model.PaymentMethodId) ==
|
||||
PaymentTypes.CHAIN.GetPaymentMethodId("BTC"))
|
||||
.PaymentLink, tester.ExplorerNode.Network);
|
||||
var remainingPaymentTx = await tester.ExplorerNode.SendToAddressAsync(invoicePaymentRequest.Address, Money.Coins(invoicePaymentRequest.Amount.ToDecimal(MoneyUnit.BTC)));
|
||||
await user.AssertHasWebhookEvent(WebhookEventType.InvoiceReceivedPayment,
|
||||
(WebhookInvoiceReceivedPaymentEvent x) =>
|
||||
{
|
||||
Assert.Equal(invoice.Id, x.InvoiceId);
|
||||
Assert.Contains(remainingPaymentTx.ToString(), x.Payment.Id);
|
||||
});
|
||||
|
||||
await user.AssertHasWebhookEvent(WebhookEventType.InvoiceProcessing, (WebhookInvoiceEvent x) => Assert.Equal(invoice.Id, x.InvoiceId));
|
||||
await tester.ExplorerNode.GenerateAsync(1);
|
||||
|
||||
|
||||
await user.AssertHasWebhookEvent(WebhookEventType.InvoicePaymentSettled,
|
||||
(WebhookInvoiceReceivedPaymentEvent x) =>
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue