dojo-test

Generate Cairo unit and integration tests for Dojo models and systems.

1|Updated Mar 7, 2026
One-click install
npx skills add https://github.com/shariqazeem/Prophecy-Roguelite --skill dojo-test-shariqazeem
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dojo-test
Source: https://github.com/shariqazeem/Prophecy-Roguelite/tree/main/.agents/skills/dojo-test
Command: npx skills add https://github.com/shariqazeem/Prophecy-Roguelite --skill dojo-test-shariqazeem

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a fast, repeatable way to generate comprehensive unit and integration tests for Dojo-based Cairo projects so developers can validate game logic, model state transitions, and permissioned system behavior without manual test scaffolding.

Core Features & Use Cases

  • Spawn test world setup: Automatically includes spawn_test_world() scaffolding and namespace/contract definitions for integration scenarios.
  • Model and system assertions: Produces #[cfg(test)] modules with assertions using world.read_model, world.write_model_test, and world.erase_model to verify state changes.
  • Cheat-code driven scenarios: Integrates testing cheat codes (set_caller_address, set_block_timestamp, set_contract_address) to simulate different execution contexts and multi-player tests.
  • Test organization: Advises where to place unit tests in model files and integration tests in a tests/ directory and includes patterns for expected panics and multiple-player flows.
  • Use case: Create integration tests that spawn a player, perform moves via an actions system, and assert both Position and Moves model updates.

Quick Start

Generate an integration test that verifies the move system updates Position and decrements Moves for a spawned player.

Frequently Asked Questions about dojo-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Dojo tests for Cairo models and systems?

Dojo tests for Cairo models and systems use spawn_test_world setup, world.read_model and world.write_model_test assertions, and optional should_panic checks to validate game logic and state transitions. Tests require #[cfg(test)] guards and proper model registrations.

What is spawn_test_world used for in Dojo integration tests?

spawn_test_world is used in Dojo integration tests to scaffold test world setup with namespace and contract definitions. It enables multi-player flow testing by spawning players and validating model state changes through system interactions like movement and actions.

Can I use cheat codes to simulate different execution contexts in Cairo tests?

Cheat codes like set_caller_address, set_block_timestamp, and set_contract_address simulate different execution contexts in Cairo tests. They enable multi-player test scenarios and verify permissioned model interactions within Dojo systems.

How do I test permissioned model interactions in a Dojo world?

Permissioned model interactions in a Dojo world are tested using world.sync_perms_and_inits along with world.read_model, world.write_model_test, and world.erase_model assertions. These verify state transitions and enforce access control for system actions.

Where should I place unit tests vs integration tests in a Dojo Cairo project?

Unit tests belong in model files with #[cfg(test)] guards, while integration tests go in a separate tests directory. Integration tests use spawn_test_world setup for full system validation, and unit tests focus on individual model logic.

How do I assert Position and Moves model updates after a Dojo move system call?

After spawning a player and calling the actions system, assert Position and Moves model updates using world.read_model calls. Verify the move system updates Position coordinates and decrements Moves count within the test world environment.