neon-sprawl/bruno/neon-sprawl-server/inventory/Get inventory.bru

42 lines
1.2 KiB
Plaintext

meta {
name: GET inventory
type: http
seq: 1
}
docs {
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.
}
get {
url: {{baseUrl}}/game/players/dev-local-1/inventory
body: none
auth: none
}
tests {
test("returns 200 JSON with schema v1 and fixed slot arrays", function () {
expect(res.getStatus()).to.equal(200);
expect(res.getHeader("content-type")).to.contain("application/json");
const body = res.getBody();
expect(body.schemaVersion).to.equal(1);
expect(body.playerId).to.equal("dev-local-1");
expect(body.bagSlots).to.be.an("array");
expect(body.bagSlots.length).to.equal(24);
expect(body.equipmentSlots).to.be.an("array");
expect(body.equipmentSlots.length).to.equal(1);
});
test("empty slots omit itemId and use quantity 0", function () {
const body = res.getBody();
for (const slot of body.bagSlots) {
expect(slot.slotIndex).to.be.a("number");
expect(slot.quantity).to.equal(0);
expect(slot.itemId).to.equal(undefined);
}
expect(body.equipmentSlots[0].quantity).to.equal(0);
expect(body.equipmentSlots[0].itemId).to.equal(undefined);
});
}