Context: Hardening pass before the analytics pivot leans on these contracts more heavily for indexing.
Where:
upgrade/src/test.rs -- upgrade has no test file yet -- this issue includes creating upgrade/src/test.rs
What to do:
- Add test coverage for the full
propose_upgrade -> approve_upgrade flow in upgrade/src/lib.rs's UpgradeManager.
- Follow the existing test conventions used elsewhere in the workspace (e.g.
escrow/src/test.rs, governance/src/test.rs) for env/contract setup boilerplate.
Suggested approach:
- Read
upgrade/src/lib.rs end to end first -- write down every state transition and every Result::Err path before writing a single test, so you're testing behavior you've actually verified exists, not behavior you assume exists.
- Cover the happy path first, then the specific edge case named in this issue, then at least one "should fail" case (wrong caller, wrong state, etc.).
- Use Soroban's test
Env with Env::default() and mock auths (env.mock_all_auths() or targeted auth mocking) matching the pattern already used in sibling test files.
- Since
upgrade has no test file yet, set up upgrade/src/test.rs from scratch -- copy the env/contract-registration boilerplate from a sibling crate's test file (e.g. escrow/src/test.rs) rather than reinventing it, and add mod test; to upgrade/src/lib.rs.
Watch out for:
Definition of done:
Context: Hardening pass before the analytics pivot leans on these contracts more heavily for indexing.
Where:
upgrade/src/test.rs-- upgrade has no test file yet -- this issue includes creatingupgrade/src/test.rsWhat to do:
propose_upgrade->approve_upgradeflow inupgrade/src/lib.rs'sUpgradeManager.escrow/src/test.rs,governance/src/test.rs) for env/contract setup boilerplate.Suggested approach:
upgrade/src/lib.rsend to end first -- write down every state transition and everyResult::Errpath before writing a single test, so you're testing behavior you've actually verified exists, not behavior you assume exists.EnvwithEnv::default()and mock auths (env.mock_all_auths()or targeted auth mocking) matching the pattern already used in sibling test files.upgradehas no test file yet, set upupgrade/src/test.rsfrom scratch -- copy the env/contract-registration boilerplate from a sibling crate's test file (e.g.escrow/src/test.rs) rather than reinventing it, and addmod test;toupgrade/src/lib.rs.Watch out for:
Definition of done:
cargo test -p upgradepassescargo test