Skip to content

Re-enable disabled API-drift test modules and wire the tests/ directory into the crate #582

Description

@greatest0fallt1me

Description

A large portion of the contract's test suite is dormant. contracts/predictify-hybrid/src/lib.rs disables many modules via #[cfg(any())] or commented-out mod declarations with the note "disabled - API drift" (for example validation_tests, circuit_breaker_tests, category_tags_tests, query_tests, bet_tests, balance_tests, governance_tests, event_management_tests). Separately, the contracts/predictify-hybrid/src/tests/ subdirectory has its own mod.rs but is never declared in lib.rs, so those suites (common, error_scenarios, integration, security, mocks, dispute_stake_tests) never compile. This issue restores the disabled coverage incrementally.

Requirements and context

  • contracts/predictify-hybrid/src/lib.rs:68 comments out mod validation_tests; // disabled - API drift; lines ~83, 130, and the block at ~104-138 disable additional suites.
  • contracts/predictify-hybrid/src/tests/mod.rs exists but there is no mod tests; in lib.rs (only a commented #[path = "tests/dispute_stake_tests.rs"]).
  • Each re-enabled module must be brought back into line with current pub fn signatures in markets.rs, bets.rs, disputes.rs, queries.rs, governance.rs, etc. (the same class of arity/field drift fixed elsewhere).
  • Non-functional: re-enable in small, reviewable batches; a module should only be uncommented once it compiles and passes, so cargo test stays green at each step.
  • Track which modules are intentionally obsolete (e.g. superseded by tests/ equivalents) and delete rather than resurrect duplicates.

Acceptance criteria

  • At least the validation_tests, query_tests, and bet_tests modules are re-enabled and passing (or formally removed with justification if superseded).
  • The tests/ subdirectory is wired in via mod tests; (gated by #[cfg(test)]) or its modules are individually declared, and they compile.
  • No module remains gated by #[cfg(any())] without an inline comment explaining why it stays disabled.
  • cargo test -p predictify-hybrid runs the newly enabled suites and reports them in the summary.
  • cargo fmt, cargo clippy, and cargo test pass.

Suggested execution

1. Fork the repo and create a branchgit checkout -b feature/reenable-drifted-tests.
2. Implement changes — edit contracts/predictify-hybrid/src/lib.rs module declarations; fix the re-enabled *_tests.rs files and wire contracts/predictify-hybrid/src/tests/.
3. Write/extend tests — update the resurrected modules to the current API; reuse helpers from tests/common.rs and tests/mocks/.
4. Test and commit

cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test -p predictify-hybrid

Example commit message

test: re-enable drifted validation/query/bet suites and wire tests/ module

Guidelines

Target the repo's ≥90% coverage standard once suites are restored. Document the re-enablement status in the test module doc-comments and note remaining gaps in TEST_EXECUTION_REPORT.md. Timeframe: 96 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions