Use test fixtures

From 0xMiden/protocol · View interactive version

Use test fixtures is an AI agent skill from the GitHub repository 0xMiden/protocol. Use when a Rust or MASM test needs to construct an account, note, transaction, or other domain object — build it with the existing test fixtures.

How to use this skill

Skill file

Use Existing Test Fixtures, Don't Hand-Roll

Rule

When a test needs a domain object, reach for the existing fixture infrastructure:

Don't write a new AccountId::dummy(...), Note::test_only(...), or one-off random helper. If the existing fixtures can't express what you need, extend them — don't fork.

Why

Shared fixtures encode the domain's validation rules, so a fixture-built object has the right bits and survives serialization; a hand-rolled dummy() usually doesn't, letting tests pass against invariants the real code never enforces. Reusing fixtures also lets one upgrade propagate to every test.

Examples

// Good
let note = NoteBuilder::new()
    .recipient(test_recipient())
    .with_asset(rand_value())
    .build()?;

let account_id = AccountIdBuilder::new().build();

// Bad
let note = Note {
    metadata: NoteMetadata::default(),
    inputs: NoteInputs::default(),
    assets: NoteAssets::default(),
    recipient: NoteRecipient::dummy(),
};

let account_id = AccountId::try_from(Word::default()).unwrap();
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.