42 lines
1.0 KiB
Plaintext
42 lines
1.0 KiB
Plaintext
meta {
|
|
name: POST inventory add
|
|
type: http
|
|
seq: 2
|
|
}
|
|
|
|
docs {
|
|
NEO-55: add stack via mutationKind add; see server README inventory HTTP section.
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/game/players/dev-local-1/inventory
|
|
body: json
|
|
auth: none
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"schemaVersion": 1,
|
|
"mutationKind": "add",
|
|
"itemId": "scrap_metal_bulk",
|
|
"quantity": 5
|
|
}
|
|
}
|
|
|
|
tests {
|
|
test("add returns 200 with applied true and updated inventory", function () {
|
|
expect(res.getStatus()).to.equal(200);
|
|
const body = res.getBody();
|
|
expect(body.schemaVersion).to.equal(1);
|
|
expect(body.applied).to.equal(true);
|
|
expect(body.reasonCode).to.equal(null);
|
|
expect(body.inventory).to.be.an("object");
|
|
expect(body.inventory.playerId).to.equal("dev-local-1");
|
|
const occupied = body.inventory.bagSlots.filter((s) => s.quantity > 0);
|
|
expect(occupied.length).to.be.at.least(1);
|
|
const scrap = occupied.find((s) => s.itemId === "scrap_metal_bulk");
|
|
expect(scrap).to.be.an("object");
|
|
expect(scrap.quantity).to.be.at.least(5);
|
|
});
|
|
}
|