Skip to content

Add with_campaign fixture for per-test parallel-safety - #61

Merged
P3az3 merged 2 commits into
MillestoneX:mainfrom
usmanimamu17-create:fix/issue-32-per-test-cleanup-hook
Jul 22, 2026
Merged

Add with_campaign fixture for per-test parallel-safety#61
P3az3 merged 2 commits into
MillestoneX:mainfrom
usmanimamu17-create:fix/issue-32-per-test-cleanup-hook

Conversation

@usmanimamu17-create

Copy link
Copy Markdown
Contributor

Summary

Add a reusable test fixture that sets up a fully initialized campaign environment with clean per-test isolation.

Changes

  • Added CampaignFixture struct with env, creator, contract_id, and campaign state
  • Added with_campaign(prefix) helper that creates an Env, registers and initializes the campaign contract
  • Includes ordering guidance for mock_all_auths, contract method invocation, and storage assertions
  • Prefix parameter reserved for future parallel-test scoping
  • Existing tests remain unaffected — opt in incrementally

Closes #32

@usmanimamu17-create
usmanimamu17-create force-pushed the fix/issue-32-per-test-cleanup-hook branch from e050388 to 35cc187 Compare July 22, 2026 15:30
usmanimamu17-create and others added 2 commits July 22, 2026 16:26
Add a CampaignFixture struct and with_campaign helper that sets up a
fully initialized campaign environment, enabling:

- Clean per-test isolation via dedicated Env instances
- Optional human-readable prefix for future parallel-test scoping
- Consistent mock_all_auths and ordering guidance
- Existing tests can opt in incrementally

Closes MillestoneX#32
The use crate::types::{...} import in the test module was split across
four lines, causing cargo fmt --check to fail. Collapse to a single line
to satisfy the rustfmt style enforced by CI.
@usmanimamu17-create
usmanimamu17-create force-pushed the fix/issue-32-per-test-cleanup-hook branch from 143881a to 549ed23 Compare July 22, 2026 16:26

@P3az3 P3az3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@P3az3
P3az3 merged commit c7592cf into MillestoneX:main Jul 22, 2026
4 checks passed
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.

Provide an explicit per-test cleanup hook (single-env fixture) for parallel-safety

2 participants