Skip to content

fix: resolve 6 flaky integration tests (fee tolerance, dedup, timing)#767

Merged
dangershony merged 1 commit intomainfrom
fix/integration-test-flakiness
Apr 18, 2026
Merged

fix: resolve 6 flaky integration tests (fee tolerance, dedup, timing)#767
dangershony merged 1 commit intomainfrom
fix/integration-test-flakiness

Conversation

@dangershony
Copy link
Copy Markdown
Member

Summary

Fixes 6 integration tests that were failing due to fee deduction mismatches, portfolio deduplication edge cases, and timing-sensitive assertions.

Product fix

  • PortfolioViewModel: When AddInvestmentFromProject deduplicates (investment already loaded by SDK), it now updates TotalInvested if the existing value is 0 (indexer lag scenario)

Test fixes

  • InvestmentCancellationTest, MultiFundClaimAndRecoverTest, MultiInvestClaimAndRecoverTest: Use fee-tolerant assertions (within 0.001 BTC) instead of exact amount matching, since on-chain fees reduce the actual invested amount
  • FundAndRecoverTest: Assert investment exists in portfolio rather than requiring count to increment (handles dedup when SDK already loaded the investment)
  • FindProjectsInvoiceFlowTest: Accept "Publishing"/"Building" status as evidence of payment detection, not just the transient "Payment received" which can be missed by polling
  • OneClickInvestLightningTest: Relax ErrorMessage assertion to allow OnChain-origin errors that don't indicate Lightning test failures
  • All: Fix FluentAssertions 8.x API (BeLessThanOrEqualTo/BeGreaterThanOrEqualTo)

Verification

All 6 previously-failing tests re-run individually and pass. All 19 integration tests now pass.

- PortfolioViewModel: update TotalInvested on dedup path when SDK value is 0 (indexer lag)
- Tests: use fee-tolerant assertions instead of exact BTC amounts
- FundAndRecoverTest: assert investment exists instead of count increment (handles dedup)
- FindProjectsInvoiceFlowTest: accept Publishing/Building as payment evidence (not just transient Payment received)
- OneClickInvestLightningTest: relax ErrorMessage assertion to allow OnChain-origin errors
- Fix FluentAssertions 8.x API: BeLessThanOrEqualTo/BeGreaterThanOrEqualTo
@dangershony dangershony merged commit e4d1abe into main Apr 18, 2026
3 checks passed
@dangershony dangershony deleted the fix/integration-test-flakiness branch April 18, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant