First commit, phased 1 and 2 created but untested

This commit is contained in:
bepis
2026-10-20 07:40:35 +11:00
commit 7a3e408ffc
66 changed files with 5639 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const { CLASSES, CLASS_KEYS, getClass, getBaseStats } = require('../../src/game/classes');
test('CLASSES contains exactly 3 classes', () => {
assert.equal(CLASS_KEYS.length, 3);
assert.ok(CLASS_KEYS.includes('warrior'));
assert.ok(CLASS_KEYS.includes('mage'));
assert.ok(CLASS_KEYS.includes('ranger'));
});
test('getClass returns correct base stats for warrior', () => {
const stats = getBaseStats('warrior');
assert.equal(stats.str, 8);
assert.equal(stats.agi, 4);
assert.equal(stats.int, 2);
assert.equal(stats.vit, 8);
});
test('getClass returns correct base stats for mage', () => {
const stats = getBaseStats('mage');
assert.equal(stats.str, 2);
assert.equal(stats.agi, 4);
assert.equal(stats.int, 9);
assert.equal(stats.vit, 5);
});
test('getClass returns correct base stats for ranger', () => {
const stats = getBaseStats('ranger');
assert.equal(stats.str, 5);
assert.equal(stats.agi, 9);
assert.equal(stats.int, 3);
assert.equal(stats.vit, 5);
});
test('getClass throws for unknown class', () => {
assert.throws(() => getClass('paladin'), Error);
});
test('getClass returns the class object with name and primary', () => {
const warrior = getClass('warrior');
assert.equal(warrior.name, 'Warrior');
assert.equal(warrior.primary, 'str');
assert.ok(warrior.bonuses.defensePct);
const mage = getClass('mage');
assert.equal(mage.primary, 'int');
assert.ok(mage.bonuses.magicVsHighDef);
const ranger = getClass('ranger');
assert.equal(ranger.primary, 'agi');
assert.ok(ranger.bonuses.critChance);
});