step 10.13: done

This commit is contained in:
bepis
2026-10-23 05:16:35 +11:00
parent 4277b9c273
commit 32fb0eee9a
8 changed files with 290 additions and 78 deletions
+8 -4
View File
@@ -123,11 +123,15 @@ describe('huntService.hunt', () => {
const id = makeHero({ energy: 100, energy_updated_at: NOW });
run(id, 100);
run(id, 100);
// stackableId and weaponId are set up in before() with 100% drop rate on monster 100.
// Starter kit has 2 potions (item 14), hunts add 2 more → total 4.
const stack = db.prepare('SELECT quantity FROM inventory WHERE character_id = ? AND item_id = ?').all(id, stackableId);
assert.equal(stack.length, 1);
assert.equal(stack[0].quantity, 2);
const weapons = db.prepare('SELECT quantity FROM inventory WHERE character_id = ? AND item_id = ?').all(id, weaponId);
assert.equal(weapons.length, 2);
assert.ok(weapons.every((w) => w.quantity === 1));
assert.equal(stack[0].quantity, 4);
// weaponId is the first non-stackable weapon (item 1 = Rusty Sword).
// Starter kit has 1 equipped, 2 drops from hunts → total 3 rows.
const allWeapons = db.prepare('SELECT quantity FROM inventory WHERE character_id = ? AND item_id = ?').all(id, weaponId);
assert.equal(allWeapons.length, 3);
assert.ok(allWeapons.every((w) => w.quantity === 1));
});
});