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
parent
db7c443b50
commit
2221dc6b4b
|
|
@ -5,7 +5,7 @@ meta {
|
||||||
}
|
}
|
||||||
|
|
||||||
docs {
|
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 {
|
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 {
|
tests {
|
||||||
test("denies with invalid_quantity", function () {
|
test("denies with invalid_quantity without consuming scrap", function () {
|
||||||
expect(res.getStatus()).to.equal(200);
|
expect(res.getStatus()).to.equal(200);
|
||||||
const body = res.getBody();
|
const body = res.getBody();
|
||||||
expect(body.schemaVersion).to.equal(1);
|
expect(body.schemaVersion).to.equal(1);
|
||||||
expect(body.success).to.equal(false);
|
expect(body.success).to.equal(false);
|
||||||
expect(body.reasonCode).to.equal("invalid_quantity");
|
expect(body.reasonCode).to.equal("invalid_quantity");
|
||||||
const before = bru.getVar("scrapBeforeInvalidQuantityDeny");
|
expect(bru.getVar("scrapAfterInvalidQuantityDeny")).to.equal(
|
||||||
expect(before).to.equal(5);
|
bru.getVar("scrapBeforeInvalidQuantityDeny"),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ tests {
|
||||||
const body = res.getBody();
|
const body = res.getBody();
|
||||||
expect(body.schemaVersion).to.equal(1);
|
expect(body.schemaVersion).to.equal(1);
|
||||||
expect(body.success).to.equal(true);
|
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.outputsGranted).to.deep.include({ itemId: "field_stim_mk0", quantity: 1 });
|
||||||
expect(body.xpGrantSummary).to.be.an("object");
|
expect(body.xpGrantSummary).to.be.an("object");
|
||||||
expect(body.xpGrantSummary.skillId).to.equal("refine");
|
expect(body.xpGrantSummary.skillId).to.equal("refine");
|
||||||
|
|
@ -147,6 +147,6 @@ tests {
|
||||||
const refine = progression.skills.find((row) => row.id === "refine");
|
const refine = progression.skills.find((row) => row.id === "refine");
|
||||||
const before = bru.getVar("refineXpBeforeSpine");
|
const before = bru.getVar("refineXpBeforeSpine");
|
||||||
expect(refine).to.be.an("object");
|
expect(refine).to.be.an("object");
|
||||||
expect(refine.xp - before).to.be.at.least(20);
|
expect(refine.xp - before).to.be.at.least(10);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue