Skip to content

[HARD][TESTING] Build an end-to-end financial integration test harness with isolated MongoDB and provider mocks #94

Description

@Obiajulu-gif

Overview

Create a deterministic integration-test environment that exercises complete ChainMove financial workflows through real route handlers and database models without requiring production credentials.

Problem

Unit tests cannot detect transaction-boundary bugs, duplicate webhook credits, authorization gaps, inconsistent model updates, or broken multi-step flows. Contributors need a repeatable way to prove financial behavior end to end.

Scope

  • Start an isolated disposable MongoDB database for the test suite.
  • Add factories for users, roles, pools, vehicles, contracts, investments, transactions, schedules, and provider events.
  • Provide realistic Paystack, Privy/JWKS, Resend, and Stellar mock adapters with failure injection.
  • Exercise APIs through HTTP-compatible requests rather than calling internal functions only.
  • Add scenario tests for investor funding and investment, driver DVA repayment, failed and duplicate webhooks, pool cancellation/refund, KYC authorization, payout distribution, and reconciliation.
  • Add concurrency tests for investment capacity and duplicate financial requests.
  • Verify database and ledger invariants after every scenario.
  • Ensure test data is isolated and cleaned even after failures.
  • Run the suite in CI with safe mock configuration.

Acceptance criteria

  • Tests require no maintainer secrets or external network calls.
  • Every scenario starts from a known database state.
  • Failures produce readable diagnostics without exposing secret-like fixture values.
  • Concurrent scenarios are deterministic enough for CI.
  • The harness detects unhandled network requests.
  • Core financial invariants are shared assertions, not duplicated ad hoc.

Tests required

The issue itself must add the scenario suite listed above and demonstrate at least one failure-injection path for each provider adapter.

Documentation

Add commands, architecture, fixture rules, debugging guidance, and how contributors add new scenarios.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions