dojo-test

Generate Cairo unit and integration tests for Dojo smart contracts.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Kepler22bee/House-of-Stark --skill dojo-test-kepler22bee
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dojo-test
Source: https://github.com/Kepler22bee/House-of-Stark/tree/main/contracts/.agents/skills/dojo-test
Command: npx skills add https://github.com/Kepler22bee/House-of-Stark --skill dojo-test-kepler22bee

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing reliable Cairo tests for Dojo models and systems is repetitive and error-prone, and developers need a consistent pattern for unit and integration tests that exercise world state, permissions, and cheat-code scenarios. This Skill provides a structured way to generate tests that set up spawn_test_world, manipulate execution context, and assert state transitions so bugs are caught early.

Core Features & Use Cases

  • Structured Test Generation: Produces unit tests inside model files and integration tests in a tests/ directory following Dojo conventions.
  • Deterministic World Setup: Uses spawn_test_world, namespace and contract defs, and world.sync_perms_and_inits to create reproducible test environments.
  • Cheat Codes & Assertions: Demonstrates use of testing cheat codes (caller, contract address, timestamp, block number) and common assertions for read/write/erase model operations.
  • Use Cases: Verify move system behavior, test Position model read/write semantics, assert expected panics, and validate multi-player state isolation.

Quick Start

Generate tests for the move system that verify position updates and move consumption using spawn_test_world and clear assertions.

Frequently Asked Questions about dojo-test

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

FAQPage Schema
How do I write Cairo tests for Dojo smart contracts using spawn_test_world?

Dojo Cairo tests use spawn_test_world to create a deterministic world environment, combined with world.sync_perms_and_inits for setup. This Skill generates unit tests inside model files and integration tests in a tests/ directory, applying dojo_cairo_test utilities for reproducible contract testing.

Can I manipulate caller address and block timestamp in Dojo Cairo tests?

Yes, Dojo Cairo tests support testing cheat codes for manipulating caller address, contract address, block timestamp, and block number. This Skill generates test files that demonstrate these cheat code scenarios to verify execution context changes during system behavior testing.

What is the best way to test Dojo model state transitions and permissions?

Testing Dojo model state transitions involves using world.read_model and write_model_test assertions to verify read, write, and erase operations. This Skill generates tests that validate permission syncs and state changes to catch bugs early in development.

Does this approach work with sozo test for integration testing?

Yes, generated tests are compatible with sozo test for running both unit and integration test suites. This Skill produces test files following Dojo conventions, ensuring spawn_test_world setup and model assertions execute correctly within the sozo test framework.

How do I test multi-player state isolation in a Dojo game world?

Multi-player state isolation in Dojo game worlds is tested by spawning a deterministic test world and asserting individual model states per player. This Skill generates integration tests that verify move system behavior and Position model read/write semantics across multiple callers.

Why do my Dojo tests fail when setting up world state and permissions?

Dojo tests often fail without proper world initialization using spawn_test_world and world.sync_perms_and_inits. This Skill generates tests that correctly configure namespace and contract defs, ensuring permission synchronization and model initialization produce reproducible test environments.