Skip to content

feat: implement mutation testing via cargo-mutants and improve test coverage (issue #483)#547

Merged
nanaf6203-bit merged 2 commits into
MettaChain:mainfrom
intelliDean:feat/mutation-testing-issue-483
Jun 24, 2026
Merged

feat: implement mutation testing via cargo-mutants and improve test coverage (issue #483)#547
nanaf6203-bit merged 2 commits into
MettaChain:mainfrom
intelliDean:feat/mutation-testing-issue-483

Conversation

@intelliDean

@intelliDean intelliDean commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

This PR implements mutation testing via cargo-mutants to ensure high-quality test coverage on critical financial functions in the property-token contract (Issue #483).

Closes #483

Key Accomplishments:

  1. Compilation Issues Resolved:

    • Fixed KycTier duplicate enum variants in contracts/identity/lib.rs.
    • Fixed duplicate CircuitBreaker struct definitions in contracts/lib/src/lib.rs.
    • Restored missing staking fields (share_stakes, etc.) and resolved type/function duplication in contracts/property-token/src/lib.rs.
    • Included the test suite in the contract module via include!("tests.rs") to bypass proc-macro file module limitations.
  2. Expanded Test Coverage:

    • Added 21 new unit tests in property-token/src/tests.rs covering all previously missed mutation paths for transfers, share issue/redemptions, dividend distributions, withdrawals, and marketplace asks.
    • Refactored assertions to perform precise value checks (such as verifying exact dividend payout amounts) instead of simple > 0 assertions.
    • All 61 unit tests compile cleanly and pass successfully.
  3. cargo-mutants Configuration:

    • Configured .cargo/mutants.toml for standard compilation parameters and targeted exclusions.
  4. CI/CD Integration:

    • Created a nightly GitHub Actions workflow (.github/workflows/nightly-mutation-test.yml) to run mutation testing daily on a cron schedule automatically.
  5. Documentation:

    • Added a Mutation Testing section to docs/testing-guide.md detailing local execution commands, mutants configuration, and nighty CI workflows.

Verification Results

Unit Tests

cargo test -p property-token --features std

close issue #483

@drips-wave

drips-wave Bot commented Jun 23, 2026

Copy link
Copy Markdown

@intelliDean Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@nanaf6203-bit nanaf6203-bit merged commit 7b283b8 into MettaChain:main Jun 24, 2026
2 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: Add mutation testing to verify test suite quality

2 participants