Skip to content

[Chore] adapter-common has zero test coverage #655

Description

@collinsezedike

Description

packages/contracts/adapter-common/src/lib.rs has no #[cfg(test)] module at all, despite being shared scaffolding used by both blend-adapter and defindex-adapter. Every helper in it (require_not_initialized, store_vault_and_usdc, require_vault_auth, get_vault, get_usdc, get_or_not_initialized) is only ever exercised indirectly through the two adapters' own tests, which always initialize via __constructor first — so the "not yet initialized" branches are never actually hit by any test in the repo. For example, get_vault(env) returning None (the pre-init state) has zero direct coverage.

Acceptance Criteria

  • A new #[cfg(test)] mod tests in adapter-common/src/lib.rs asserts get_vault(&env) returns None before store_vault_and_usdc is called, and Some(vault) after.
  • A test asserts require_not_initialized returns Err(AlreadyInitialized) once VAULT_KEY is already set.
  • cargo test -p adapter-common runs and passes.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programchoreBuild, CI, dependency updates, or repository maintenancecontractsInvolves writing or testing Rust/Soroban contracts in packages/contractsmediumRequires familiarity with the Meridian codebase or relevant tooling; expect 4–8 hourstestingAdds or improves test coverage (unit, integration, or e2e)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions