meta { name: POST inventory add deny invalid item type: http seq: 3 } docs { NEO-55: unknown itemId denies with invalid_item. Pre-request snapshots scrap_metal_bulk total to prove inventory unchanged on deny. } script:pre-request { const { getInventory, sumItemQuantity } = require("./scripts/inventory-api-helper.js"); const inventory = await getInventory(bru); bru.setVar("scrapBeforeDeny", sumItemQuantity(inventory, "scrap_metal_bulk")); } post { url: {{baseUrl}}/game/players/{{playerId}}/inventory body: json auth: none } body:json { { "schemaVersion": 1, "mutationKind": "add", "itemId": "not-a-prototype-item", "quantity": 1 } } tests { test("denies with invalid_item and leaves scrap_metal_bulk unchanged", function () { expect(res.getStatus()).to.equal(200); const body = res.getBody(); expect(body.schemaVersion).to.equal(1); expect(body.applied).to.equal(false); expect(body.reasonCode).to.equal("invalid_item"); expect(body.inventory).to.be.an("object"); expect(body.inventory.bagSlots.length).to.equal(24); const before = bru.getVar("scrapBeforeDeny"); const after = [...body.inventory.bagSlots, ...body.inventory.equipmentSlots] .filter((slot) => slot.itemId === "scrap_metal_bulk") .reduce((total, slot) => total + slot.quantity, 0); expect(after).to.equal(before); }); }