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
Complexity: Low (50 points)
Description
The test
test_fund_cancelled_listingincontracts/marketplace/src/lib.rs(lines 901–914) calls asetup()function that does not exist in the test module:The test module only defines
deploy()(which returns aTestEnvstruct) andlist_one(). There is nosetup()function, and the destructuring pattern(env, admin, _nft, _pool, _treasury, client)does not matchTestEnvanyway.This causes a compile-time
E0425: cannot find functionsetupin this scopeerror. 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 correctdeploy()helper and update the destructuring to use theTestEnvstruct:Acceptance Criteria
test_fund_cancelled_listingcompiles without errors.setup()function.Complexity: Low (50 points)