NEO-70: Fix Bruno craft assertions for CI wire JSON shape.

Expect omitted reasonCode on success, refine XP delta >= 10 when refine
is skipped, and scrap unchanged on invalid_quantity without fixed totals.
pull/104/head
VinPropane 2026-05-24 18:10:17 -04:00
parent db7c443b50
commit 2221dc6b4b
2 changed files with 13 additions and 6 deletions

View File

@ -5,7 +5,7 @@ meta {
}
docs {
NEO-70: non-positive quantity denies with invalid_quantity.
NEO-70: non-positive quantity denies with invalid_quantity without consuming inputs.
}
script:pre-request {
@ -33,14 +33,21 @@ body:json {
}
}
script:post-response {
const { getInventory, sumItemQuantity } = require("./scripts/inventory-api-helper.js");
const inventory = await getInventory(bru);
bru.setVar("scrapAfterInvalidQuantityDeny", sumItemQuantity(inventory, "scrap_metal_bulk"));
}
tests {
test("denies with invalid_quantity", function () {
test("denies with invalid_quantity without consuming scrap", function () {
expect(res.getStatus()).to.equal(200);
const body = res.getBody();
expect(body.schemaVersion).to.equal(1);
expect(body.success).to.equal(false);
expect(body.reasonCode).to.equal("invalid_quantity");
const before = bru.getVar("scrapBeforeInvalidQuantityDeny");
expect(before).to.equal(5);
expect(bru.getVar("scrapAfterInvalidQuantityDeny")).to.equal(
bru.getVar("scrapBeforeInvalidQuantityDeny"),
);
});
}

View File

@ -126,7 +126,7 @@ tests {
const body = res.getBody();
expect(body.schemaVersion).to.equal(1);
expect(body.success).to.equal(true);
expect(body.reasonCode).to.equal(null);
expect(body.reasonCode).to.be.undefined;
expect(body.outputsGranted).to.deep.include({ itemId: "field_stim_mk0", quantity: 1 });
expect(body.xpGrantSummary).to.be.an("object");
expect(body.xpGrantSummary.skillId).to.equal("refine");
@ -147,6 +147,6 @@ tests {
const refine = progression.skills.find((row) => row.id === "refine");
const before = bru.getVar("refineXpBeforeSpine");
expect(refine).to.be.an("object");
expect(refine.xp - before).to.be.at.least(20);
expect(refine.xp - before).to.be.at.least(10);
});
}