Skip to content

Create Comprehensive Tests for Shade-led Account Restriction #183

@codebestia

Description

@codebestia

Description 📝

Create a test suite to verify the end-to-end integration between the central Shade contract and the Merchant Account contract during the restriction process. This confirms that roles are correctly enforced at the entry point and state changes propagate across contracts.

Proposed Steps 📝

  • Test Setup:
    • Create contracts/shade/src/tests/test_shade_restriction.rs.
    • Deploy the Shade contract and register a merchant to deploy their account contract.
  • Implement Test Cases:
    • Admin Command:
      • Call restrict_merchant_account(true) as the Shade Admin.
      • Verify the Merchant Account contract's is_restricted_account() now returns true.
      • Verify Shade event emission.
    • Manager Command:
      • Call restrict_merchant_account(false) as a Shade Manager.
      • Verify the Merchant Account contract status updates correctly.
    • Unauthorized Attempt:
      • Attempt to trigger restriction from a random account or the merchant themselves through the Shade contract.
      • Expect Shade-level NotAuthorized or role check panic.
    • Invalid Merchant:
      • Attempt to restrict an account for an address that is not registered as a merchant.
      • Verify appropriate error/panic (e.g., MerchantNotFound).

Acceptance Criteria ✅

  • Tests confirm cross-contract state synchronization.
  • Access control at the Shade level is strictly verified.
  • Integration is proven to handle success and failure cases gracefully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions