Files
healer-man/scripts/runewaker-pipeline/vocation-growth.test.mjs
T
2026-09-12 23:55:24 -04:00

17 lines
847 B
JavaScript

import assert from "node:assert/strict";
import { test } from "node:test";
import { vocationGrowth } from "./vocation-growth.mjs";
test("reads the player table instead of the adjacent alternate growth table", () => {
const buffer = Buffer.alloc(140 + 22 * 408);
const offset = 140 + 21 * 408;
buffer.writeInt32LE(301021, offset);
buffer.writeInt32LE(301021, offset + 4);
const values = [14, 13, 5, 6, 12, 60, 20, 5, 4.5, 1.9, 2.1, 4.25, 2, 2, ...Array(7).fill(0.02)];
values.forEach((value, index) => buffer.writeFloatLE(value, offset + 8 + index * 4));
buffer.writeFloatLE(2.8, offset - 408 + 8 + 14 * 4);
assert.deepEqual(vocationGrowth(buffer, 10).strength, { levelOne: 14, flatGrowth: 5, percentGrowth: 0.02 });
buffer.writeInt32LE(301020, offset);
assert.throws(() => vocationGrowth(buffer, 10), /sentinel drifted/);
});