NEO-38: Bruno GET skill progression tolerant of persisted XP

pull/72/head
VinPropane 2026-05-06 22:23:11 -04:00
parent 2bcde45891
commit bab7336e5b
1 changed files with 15 additions and 5 deletions

View File

@ -6,6 +6,7 @@ meta {
docs {
NEO-37: per-player read model; join with GET /game/world/skill-definitions for display names.
NEO-38: XP persists (in-memory/Postgres). These checks do not assume a fresh server—level must match placeholder curve level = 1 + floor(max(0,xp)/100). Restart server (or truncate DB in Postgres mode) to see all-zero defaults again.
}
get {
@ -25,15 +26,24 @@ tests {
expect(body.skills.length).to.equal(3);
});
test("frozen prototype trio with default xp and level", function () {
test("frozen prototype trio with levels consistent with server placeholder curve", function () {
const body = res.getBody();
const intrusion = body.skills.find((x) => x.id === "intrusion");
expect(intrusion).to.be.an("object");
expect(intrusion.xp).to.equal(0);
expect(intrusion.level).to.equal(1);
const ids = new Set(body.skills.map((x) => x.id));
expect(ids.has("salvage")).to.equal(true);
expect(ids.has("refine")).to.equal(true);
expect(ids.has("intrusion")).to.equal(true);
/** Matches SkillLevelCurvePlaceholder (NEO-38): level = 1 + floor(max(0,xp)/100). */
const expectedLevel = (xp) => 1 + Math.floor(Math.max(0, xp) / 100);
for (const id of ["salvage", "refine", "intrusion"]) {
const row = body.skills.find((x) => x.id === id);
expect(row).to.be.an("object");
expect(row.xp).to.be.a("number");
expect(row.level).to.be.a("number");
expect(row.xp).to.be.at.least(0);
expect(row.level).to.be.at.least(1);
expect(row.level).to.equal(expectedLevel(row.xp));
}
});
}