Skip to content

test: add unit tests for upgrade() function - #309

Open
Xaxxoo wants to merge 1 commit into
Lafiya-xyz:mainfrom
Xaxxoo:fix/issue-156-upgrade-tests
Open

test: add unit tests for upgrade() function#309
Xaxxoo wants to merge 1 commit into
Lafiya-xyz:mainfrom
Xaxxoo:fix/issue-156-upgrade-tests

Conversation

@Xaxxoo

@Xaxxoo Xaxxoo commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds upgrade_emits_event_and_requires_admin_auth test verifying that admin auth is required and the Upgraded event is emitted with the correct wasm hash
  • Adds upgrade_without_admin_auth_fails test ensuring non-admin cannot call upgrade()
  • Adds upgrade_before_initialize_fails test verifying NotInitialized error when contract is not initialized

Test plan

  • cargo test passes for attester-registry crate
  • upgrade_without_admin_auth_fails fails if require_auth() is removed from upgrade()
  • upgrade_emits_event_and_requires_admin_auth fails if the Upgraded event emission is removed

Closes #156

🤖 Generated with Claude Code

Adds three new tests:
- upgrade_emits_event_and_requires_admin_auth: verifies admin auth is
  required and Upgraded event is emitted with correct wasm hash
- upgrade_without_admin_auth_fails: ensures non-admin cannot call upgrade
- upgrade_before_initialize_fails: verifies NotInitialized error

Closes Lafiya-xyz#156
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 unit tests for attester-registry's upgrade() function

1 participant