Skip to content

Cross-contract mocking test coverage #152

Description

@ibrahimmosouf-png

Cross-contract mocking test coverage

Labels: testing, priority/medium
Difficulty: Medium · Effort: M
Backlog slot: 65

Problem Statement

Existing tests run against Env::default() and the in-process token stubs (StellarAssetClient). Production cross-contract calls — real RPC, real auth frames, real event ordering — aren't unit-tested for behaviour, only for shape.

Why it Matters

  • A token::Client::new call against an actual deployed token can fail in ways the stub never reproduces (e.g. balance cache lag, expired trustline, missing auth).
  • Production regressions are caught by users, not by tests.

Expected Outcome

  1. Introduce a MockTokenClient that records assertions (calls, balances, transfers) and lets tests inject failures.
  2. Apply to release_milestone, claim_refund, donate paths where token transfers occur.
  3. Add property tests that mutate the mock state and assert the contract reads.

Acceptance Criteria

  • New mock used in ≥ 3 existing test files with no regression.
  • All cross-contract call sites have a corresponding mocked test.

Files Likely Affected

  • New: crates/testkit/src/mock_token.rs
  • campaign/src/test/*

Dependencies

Issue #29 (E2E harness).


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26priority/mediumImported from .github/ISSUES_TO_CREATE.mdtestingImported from .github/ISSUES_TO_CREATE.md

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions