Skip to content

test: admin role separation, batch operations, allowance cleanup, error handling - #369

Merged
DeFiVC merged 2 commits into
ChainLearnOfficial:mainfrom
privexlabs:test/admin-role-batch-storage-errors
Aug 30, 2026
Merged

test: admin role separation, batch operations, allowance cleanup, error handling#369
DeFiVC merged 2 commits into
ChainLearnOfficial:mainfrom
privexlabs:test/admin-role-batch-storage-errors

Conversation

@privexlabs

Copy link
Copy Markdown
Contributor

Summary

Adds the four test suites requested for this wave: integration coverage for
admin role separation and batch-style operations on the ChainLearn
contracts, plus unit coverage for expired-allowance storage cleanup and
typed error handling.

Changes

  • tests/integration/admin_role_flow.rs (new): verifies that the Minter
    and Pauser roles on learn-token are enforced independently (a minter
    can mint but not pause; a pauser can pause/unpause but not mint), that
    granting/revoking roles takes effect immediately, and that role_granted
    / role_revoked events are emitted with the correct address.
  • tests/integration/batch_operations.rs (new): verifies
    batch_claim_reward processes multiple quizzes independently (an
    already-claimed quiz is skipped without blocking the others), and
    exercises batch-style module completion and quiz submission flows
    against progress-tracker.
  • tests/unit/token_tests.rs: adds a test that cleanup_expired_allowances
    removes only expired allowances, preserves valid ones, shrinks the
    spender registry accordingly, and is a no-op on a second pass.
  • tests/unit/token_tests.rs, tests/unit/progress_tests.rs,
    tests/unit/credential_tests.rs: each adds a test asserting that
    calling initialize a second time returns the typed
    ContractError::AlreadyInitialized error (via try_initialize) rather
    than an untyped panic.
  • contracts/learn-token/src/lib.rs: re-exports AdminRole alongside the
    existing Proposal/VestingSchedule re-exports so external tests can
    reference it, since it's defined in the crate's private storage
    module.
  • Cargo.toml: registers the two new integration test files as
    [[test]] targets, matching the existing pattern for every other test
    file in the repo.

Issues

Resolves #282
Resolves #283
Resolves #284
Resolves #285

Verification

Changes were reviewed manually: git status, git diff --stat, and the
full git diff were inspected line by line against the current contract
source (role/storage/event APIs) to confirm every call matches existing
function signatures and conventions. cargo build and cargo test were
NOT run, per instructions; no test execution or compilation was performed.

harystyleseze and others added 2 commits August 30, 2026 03:09
Adds integration tests for admin role separation (minter vs pauser) and
batch-style claim/module/quiz flows, plus unit tests for expired
allowance cleanup and typed AlreadyInitialized error handling across all
three contracts. Re-exports AdminRole from learn-token so tests can
construct role values, following the existing Proposal/VestingSchedule
export pattern.
@drips-wave

drips-wave Bot commented Aug 30, 2026

Copy link
Copy Markdown

@privexlabs 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

@DeFiVC
DeFiVC merged commit 37e4df0 into ChainLearnOfficial:main Aug 30, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants