Skip to content

test(progress-tracker): add batch_complete_module edge case tests (fixes #642) - #650

Closed
lmduy2612 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
lmduy2612:test/issue-642-batch-complete-module-edge-cases
Closed

lmduy2612 wants to merge 1 commit into
ChainLearnOfficial:mainfrom
lmduy2612:test/issue-642-batch-complete-module-edge-cases

Conversation

@lmduy2612

Copy link
Copy Markdown

Closes #642.

Summary of Changes

Adds comprehensive edge-case test coverage for batch_complete_module in contracts/progress-tracker:

  • Batch size of 1: verifies completing a single module in a batch sets the correct bit in modules_completed_bitmap and increments progress (test_batch_complete_module_batch_size_one_works_like_single).
  • All modules in course: verifies submitting a batch containing all modules in the course correctly sets all bitmap bits (0b111) (test_batch_complete_module_all_modules_in_course_marks_all_complete).
  • Duplicate module IDs in batch: verifies that duplicate module IDs within the batch are rejected and panic with "module already completed" (test_batch_complete_module_rejects_duplicate_within_batch).
  • Partial failure rollback: verifies that if any module in the batch fails, the entire transaction reverts and no partial module completions persist (test_batch_complete_module_reverts_all_on_partial_failure).

Verification

  • cargo test --test progress_tests test_batch_complete_module: 11/11 tests pass.
  • Adheres strictly to project coding standards and test conventions.

@DeFiVC DeFiVC closed this Oct 19, 2026
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.

Add batch_complete_module edge case tests

2 participants