Skip to content

test_fund_cancelled_listing in marketplace tests calls undefined setup() function — compilation error #354

Description

@Mac-5

Description

The test test_fund_cancelled_listing in contracts/marketplace/src/lib.rs (lines 901–914) calls a setup() function that does not exist in the test module:

#[test]
fn test_fund_cancelled_listing() {
    let (env, admin, _nft, _pool, _treasury, client) = setup(); // ← setup() is not defined
    // ...
}

The test module only defines deploy() (which returns a TestEnv struct) and list_one(). There is no setup() function, and the destructuring pattern (env, admin, _nft, _pool, _treasury, client) does not match TestEnv anyway.

This causes a compile-time E0425: cannot find function setup in this scope error. Because this code is in #[cfg(test)], it may be masked during regular builds but will fail when tests are run.

Fix

Replace the setup() call with the correct deploy() helper and update the destructuring to use the TestEnv struct:

fn test_fund_cancelled_listing() {
    let t = deploy();
    let investor = Address::generate(&t.env);
    t.mp.list_invoice(&t.seller, &1u64, &9_500_000_000i128, &10_000_000_000i128, &t.token, &(t.env.ledger().timestamp() + 1_000_000u64));
    t.mp.cancel_listing(&t.seller, &1u64);
    let result = t.mp.try_fund_invoice(&investor, &1u64, &1_000_000_000i128);
    assert!(result.is_err());
}

Acceptance Criteria

  • test_fund_cancelled_listing compiles without errors.
  • The test passes and correctly asserts that funding a cancelled listing fails.
  • No other tests in the module reference the undefined setup() function.

Complexity: Low (50 points)

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions