Skip to content

test: create centralized test fixture library (#311) - #323

Open
mikwansa wants to merge 1 commit into
Space-Nebula:mainfrom
mikwansa:test/fixture-standardization-311
Open

test: create centralized test fixture library (#311)#323
mikwansa wants to merge 1 commit into
Space-Nebula:mainfrom
mikwansa:test/fixture-standardization-311

Conversation

@mikwansa

Copy link
Copy Markdown

Closes #311

Summary

Creates a shared test fixture library at tests/common/mod.rs to eliminate duplicated setup code across 20+ integration test files.

Helpers provided

  • setup_env() — Env with default ledger and mock auths
  • setup_contract() — full env + deployed NebulaNomadContract + client
  • advance_ledger(env, count) — advance by N ledgers
  • advance_time(env, seconds) — advance timestamp only
  • set_ledger(env, seq, ts) — exact ledger state
  • generate_addresses(env, n) — bulk Address generation
  • test_hash(env, seed) — 32-byte hash

Usage

In any test file:

mod common;
use common::*;

fn my_test() {
    let (env, client, admin) = setup_contract();
    // ...
}

Next steps

Migrate existing test files to use the shared library (separate PRs to keep changes focused).

- Create tests/common/mod.rs with shared helpers:
  - setup_env() — standard ledger + mock auths
  - setup_contract() — full env with deployed contract client
  - advance_ledger() — advance by N ledgers
  - advance_time() — advance timestamp only
  - set_ledger() — exact sequence + timestamp
  - generate_addresses() — bulk address creation
  - test_hash() — 32-byte hash from seed

All existing test files define their own duplicated versions of these
helpers. This library provides a single source of truth. To use:

```
mod common;
use common::*;
```
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

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

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.

Standardize Test Fixtures

1 participant