Skip to content

Add comprehensive unit tests for smart contract#198

Merged
Mosas2000 merged 1 commit intomainfrom
fix/add-contract-unit-tests
Mar 26, 2026
Merged

Add comprehensive unit tests for smart contract#198
Mosas2000 merged 1 commit intomainfrom
fix/add-contract-unit-tests

Conversation

@Mosas2000
Copy link
Copy Markdown
Owner

Summary

Adds 34 unit tests for the sprintfund-core contract using Clarinet SDK and Vitest.

Test Coverage

Testing

npm test  # 34 tests pass

Resolves #50

Add 34 unit tests covering all contract functions:
- Read-only functions (get-proposal, get-stake, get-min-stake-amount)
- Staking operations (stake, accumulation, record updates)
- Proposal creation (with/without stake, data validation)
- Voting mechanics (for/against, vote count updates)
- Quadratic voting cost calculations (weight 1, 10, 100)
- Stake withdrawal (partial, full, insufficient balance)
- Proposal execution (success, failure, already-executed)
- Security tests documenting known issues #11 and #12

Tests use Clarinet SDK with simnet for local blockchain simulation.
Resolves #50
@Mosas2000 Mosas2000 merged commit a8aeb59 into main Mar 26, 2026
14 of 25 checks passed
@Mosas2000 Mosas2000 deleted the fix/add-contract-unit-tests branch March 26, 2026 16:14
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.

Testing: No unit tests exist for the smart contract

1 participant