vagabond-rpg-foundryvtt/module/tests/quench-init.mjs
Cal Corum 517b7045c7 Add Phase 2 core system logic: document classes, dice rolling, and fixes
Implements Phase 2 foundational components:
- VagabondActor document class with item management, resource tracking,
  damage/healing, rest mechanics, and combat helpers
- VagabondItem document class with chat card generation and item usage
- Comprehensive dice rolling module (d20 checks, skill/attack/save rolls,
  damage with crit doubling, countdown dice, morale checks)
- Quench tests for all dice rolling functions

Fixes Foundry VTT v13 compatibility issues:
- Add documentTypes to system.json declaring valid Actor/Item types
- Fix StringField validation errors by using nullable/null pattern
  instead of blank string choices for optional fields
- Update actor tests to use embedded documents for slot calculations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 10:21:48 -06:00

75 lines
2.6 KiB
JavaScript

/**
* Quench Test Registration
*
* This module registers all Vagabond RPG test batches with the Quench testing framework.
* Tests are organized by domain: actors, items, rolls, effects.
*
* @see https://github.com/Ethaks/FVTT-Quench
*/
// Import test modules
import { registerActorTests } from "./actor.test.mjs";
import { registerDiceTests } from "./dice.test.mjs";
// import { registerItemTests } from "./item.test.mjs";
// import { registerEffectTests } from "./effects.test.mjs";
/**
* Register all Vagabond test batches with Quench
* Called from the main system init when Quench is available
* @param {Quench} quenchRunner - The Quench test runner instance
*/
export function registerQuenchTests(quenchRunner) {
// Register placeholder test batch to verify Quench integration
quenchRunner.registerBatch(
"vagabond.sanity",
(context) => {
const { describe, it, expect } = context;
describe("Vagabond System Sanity Checks", () => {
it("should have CONFIG.VAGABOND defined", () => {
expect(CONFIG.VAGABOND).to.exist;
});
it("should have all six stats configured", () => {
const stats = CONFIG.VAGABOND.stats;
expect(stats).to.have.property("might");
expect(stats).to.have.property("dexterity");
expect(stats).to.have.property("awareness");
expect(stats).to.have.property("reason");
expect(stats).to.have.property("presence");
expect(stats).to.have.property("luck");
});
it("should have all twelve skills configured", () => {
const skills = CONFIG.VAGABOND.skills;
expect(Object.keys(skills)).to.have.length(12);
});
it("should have spell delivery types configured", () => {
const delivery = CONFIG.VAGABOND.spellDelivery;
expect(delivery.touch.cost).to.equal(0);
expect(delivery.aura.cost).to.equal(2);
expect(delivery.sphere.cost).to.equal(2);
});
it("should calculate correct speed by DEX", () => {
const speedByDex = CONFIG.VAGABOND.speedByDex;
expect(speedByDex[2]).to.equal(25);
expect(speedByDex[4]).to.equal(30);
expect(speedByDex[6]).to.equal(35);
});
});
},
{ displayName: "Vagabond: Sanity Checks" }
);
// Register domain-specific test batches
registerActorTests(quenchRunner);
registerDiceTests(quenchRunner);
// registerItemTests(quenchRunner);
// registerEffectTests(quenchRunner);
// eslint-disable-next-line no-console
console.log("Vagabond RPG | Quench tests registered");
}