dojo-test

Automate deterministic unit and integration tests for Dojo models and systems.

53|92|Updated Mar 28, 2023
One-click install
npx skills add https://github.com/dojoengine/book --skill dojo-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dojo-test
Source: https://github.com/dojoengine/book/tree/main/skills/dojo-test
Command: npx skills add https://github.com/dojoengine/book --skill dojo-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers write comprehensive tests for Dojo models and systems using Cairo's test framework and Dojo's testing utilities, ensuring game logic correctness and reliable state transitions.

Core Features & Use Cases

  • Unit testing: embed tests alongside models to validate behavior.
  • Integration testing: create test worlds to verify interactions between systems and components.
  • Cheat codes & assertions: leverage test utilities to manipulate context and verify outcomes.

Quick Start

Use the quick-start examples to generate test scaffolds and run tests with the provided tooling. For example: "Write tests for the spawn system" or "Test the Position model"

Frequently Asked Questions about dojo-test

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

FAQPage Schema
How do I write integration tests for Dojo systems?

To write integration tests for Dojo systems, create test worlds using spawn_test_world to verify interactions between systems and components, leveraging cheat codes and assertions to manipulate context and confirm state changes.

What is the best way to unit test Dojo models in Cairo?

Unit testing Dojo models in Cairo involves embedding tests directly alongside the models to validate behavior, using the Cairo test framework and Dojo testing utilities to ensure game logic correctness and reliable state transitions.

How do cheat codes work when testing Dojo game logic?

Cheat codes in Dojo testing utilities manipulate the test context to simulate specific scenarios, allowing developers to apply assertions that verify resulting state changes and ensure deterministic outcomes for game logic.

Can I embed tests directly alongside Dojo models?

Yes, you can embed tests directly alongside Dojo models to validate their isolated behavior, which serves as the unit testing approach within Cairo-based Dojo projects to ensure correct model logic.

Do I need the Cairo test framework to test Dojo systems?

Yes, testing Dojo systems requires the Cairo test framework alongside Dojo testing utilities to construct deterministic tests using spawn_test_world, cheat codes, and assertions for verifying state changes.