NEO-55: fix Bruno GET inventory test for persistent dev player state

Assert slot shape rules instead of requiring an all-empty grid when
dev-local-1 already holds items from prior collection runs.
pull/90/head
VinPropane 2026-05-23 22:53:50 -04:00
parent fddbb95a45
commit 00ada50b95
2 changed files with 19 additions and 11 deletions

View File

@ -6,7 +6,8 @@ meta {
docs { docs {
NEO-55: per-player inventory read model; join with GET /game/world/item-definitions for stackMax and slot kinds. NEO-55: per-player inventory read model; join with GET /game/world/item-definitions for stackMax and slot kinds.
Fresh dev server seeds dev-local-1 with empty 24+1 slot grid. Does not assume a fresh server — dev-local-1 inventory persists across Bruno runs (in-memory/Postgres).
Restart server (or truncate DB in Postgres mode) to see an all-empty grid again.
} }
get { get {
@ -28,14 +29,22 @@ tests {
expect(body.equipmentSlots.length).to.equal(1); expect(body.equipmentSlots.length).to.equal(1);
}); });
test("empty slots omit itemId and use quantity 0", function () { test("empty slots omit itemId; occupied slots include itemId and positive quantity", function () {
const body = res.getBody(); const body = res.getBody();
for (const slot of body.bagSlots) { const assertSlotShape = (slot) => {
expect(slot.slotIndex).to.be.a("number"); expect(slot.slotIndex).to.be.a("number");
expect(slot.quantity).to.equal(0); expect(slot.quantity).to.be.a("number");
expect(slot.itemId).to.equal(undefined); expect(slot.quantity).to.be.at.least(0);
if (slot.quantity === 0) {
expect(slot.itemId).to.equal(undefined);
} else {
expect(slot.itemId).to.be.a("string");
expect(slot.itemId.length).to.be.at.least(1);
}
};
for (const slot of body.bagSlots) {
assertSlotShape(slot);
} }
expect(body.equipmentSlots[0].quantity).to.equal(0); assertSlotShape(body.equipmentSlots[0]);
expect(body.equipmentSlots[0].itemId).to.equal(undefined);
}); });
} }

View File

@ -3,8 +3,7 @@ meta {
} }
docs { docs {
NEO-55 inventory HTTP. Run GET first on a fresh dev server for empty 24+1 grid. NEO-55 inventory HTTP. GET does not assume an empty grid — dev-local-1 inventory persists across runs.
POST add/remove mutate dev-local-1; cumulative stacks from prior manual runs can make POST add/remove mutate dev-local-1; cumulative stacks from prior runs make add assertions use at.least(5).
Post inventory add assertions use at.least(5). Restart server (or truncate DB in Postgres Restart server (or truncate DB in Postgres mode) for a clean inventory baseline.
mode) for a clean inventory baseline.
} }