Skip to content

Add comprehensive test coverage analysis and improvement proposals#749

Merged
dangershony merged 3 commits intomainfrom
docs/test-coverage-analysis
Apr 14, 2026
Merged

Add comprehensive test coverage analysis and improvement proposals#749
dangershony merged 3 commits intomainfrom
docs/test-coverage-analysis

Conversation

@dangershony
Copy link
Copy Markdown
Member

Summary

Full analysis of the test suite across all 4 test projects (~294 tests), identifying coverage gaps and proposing concrete improvements.

Documents Added

Document Description
TEST_COVERAGE_ANALYSIS.md Overview of current coverage, database layer gaps, data flow analysis, and priority ranking
TEST_IMPROVEMENTS.md Specific improvements to the 7 existing E2E integration tests (DB assertions, balance deltas, cross-profile validation)
TEST_NEW_PROPOSALS.md 10 new E2E test proposals: wallet import/delete, many investors, DB integrity, subscribe type, cancellation, cache behavior, edge cases
TEST_SDK_PROPOSALS.md 8 new SDK-level test classes that can run in CI without network (LiteDB round-trips, WalletFactory, DatabaseManagementService, PortfolioService, etc.)
TEST_EDGE_CASES.md 15+ edge cases cataloged with risk levels, plus 3 bugs discovered during analysis
TEST_SDK_PARITY_ANALYSIS.md Cross-reference of SDK call comparison gaps: 7/9 resolved, 2 remaining (Lightning, tx preview), integration test coverage status for each

Key Findings

  • Database layer has near-zero test coverage -- 8 document collections, none tested for round-trip persistence
  • Wallet import/delete never tested E2E -- only "Generate" path covered
  • 3 bugs documented: orphaned DerivedProjectKeys on wallet delete, dead LiteDbDocumentMapping code, no duplicate wallet guard
  • SDK parity: 7/9 gaps from the SDK call comparison have been resolved in code, but only 1/7 has integration test coverage
  • 2 SDK gaps remain open: Lightning payments (placeholder only) and transaction draft preview (no EstimateFeeAndSize calls)

Priority Recommendations

  1. LiteDB round-trip tests (CI-friendly, no network needed)
  2. WalletFactory integration tests (CI-friendly)
  3. Wallet Import + Project Scan (E2E)
  4. Wallet Delete + Reimport (E2E)
  5. Database Integrity test (E2E)
  6. Many Investors scenario (E2E)
  7. Strengthen existing tests with DB assertions
  8. Investment cancellation, subscribe type, edge cases

Analyze all 4 test projects (~294 tests) and identify coverage gaps:
- Improvements to 7 existing E2E integration tests (DB assertions, balance deltas, cross-profile validation)
- 10 new E2E test proposals (wallet import/delete, many investors, DB integrity, subscribe type, etc.)
- 8 new SDK-level test classes (LiteDB round-trips, WalletFactory, DatabaseManagementService, PortfolioService)
- 15+ edge cases cataloged with risk assessment
- SDK call parity analysis: 7/9 gaps resolved, 2 remaining (Lightning, tx preview), only 1/7 has test coverage
- 3 bugs documented (orphaned DerivedProjectKeys on delete, dead LiteDbDocumentMapping code, no duplicate wallet guard)
@nikunjkumar05
Copy link
Copy Markdown
Contributor

Can I pick up bugs found in test_edge_cases.md ?

@dangershony
Copy link
Copy Markdown
Member Author

Can I pick up bugs found in test_edge_cases.md ?

You can do the key deletion form database

dangershony added a commit that referenced this pull request Apr 4, 2026
Implement two new E2E integration tests based on PR #749 test coverage
analysis:

- WalletImportAndProjectScanTest: validates seed import UI flow, wallet
  identity determinism (same seed = same WalletId), balance preservation,
  and ScanFounderProjects discovery after device loss recovery.

- InvestmentCancellationTest: validates above-threshold pending investment
  cancellation, fund release back to investor, and successful re-investment
  after cancel (CancelInvestmentRequest had zero E2E coverage).

Both tests follow the multi-profile WithProfileWindow pattern and include
companion markdown documentation.
dangershony added a commit that referenced this pull request Apr 13, 2026
#753)

* Add wallet import + project scan and investment cancellation E2E tests

Implement two new E2E integration tests based on PR #749 test coverage
analysis:

- WalletImportAndProjectScanTest: validates seed import UI flow, wallet
  identity determinism (same seed = same WalletId), balance preservation,
  and ScanFounderProjects discovery after device loss recovery.

- InvestmentCancellationTest: validates above-threshold pending investment
  cancellation, fund release back to investor, and successful re-investment
  after cancel (CancelInvestmentRequest had zero E2E coverage).

Both tests follow the multi-profile WithProfileWindow pattern and include
companion markdown documentation.

* Fix InvestmentCancellationTest to reload investments from SDK before cancel

AddToPortfolio does an optimistic local insert without WalletId or
TransactionId. CancelInvestmentAsync requires both fields. The test now
polls LoadInvestmentsFromSdkAsync to wait for the indexer to populate
those fields before attempting cancellation.

* Expand cancellation test to 3-step flow: cancel before approval, cancel after approval, and confirm
Re-analyze all 6 documents after ~180 new tests were added:
- Test count grew from ~294 to ~475+ (SDK tests nearly tripled)
- Mark 2/10 E2E proposals as implemented (wallet import, cancellation)
- Mark 1/8 SDK proposals as implemented (ScanFounderProjects)
- Update SDK parity: all 9 gaps now resolved (was 7/9), Lightning fully implemented
- Re-confirm all 3 bugs still exist (orphaned DB data, dead code, no duplicate guard)
- Revise priority rankings to emphasize bug fixes and LiteDB round-trip tests
@dangershony dangershony merged commit 6b75e09 into main Apr 14, 2026
3 checks passed
@dangershony dangershony deleted the docs/test-coverage-analysis branch April 14, 2026 15:35
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.

2 participants