neon-sprawl/bruno/neon-sprawl-server/item-definitions/Get item definitions.bru

51 lines
1.6 KiB
Plaintext

meta {
name: GET item definitions
type: http
seq: 1
}
get {
url: {{baseUrl}}/game/world/item-definitions
body: none
auth: none
}
tests {
test("returns 200 JSON with schema v1 and items array", 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.items).to.be.an("array");
expect(body.items.length).to.equal(6);
});
test("items are ascending by id (ordinal)", function () {
const body = res.getBody();
const ids = body.items.map((x) => x.id);
const sorted = [...ids].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
expect(ids).to.eql(sorted);
});
test("frozen prototype six is present", function () {
const body = res.getBody();
const ids = new Set(body.items.map((x) => x.id));
expect(ids.has("scrap_metal_bulk")).to.equal(true);
expect(ids.has("refined_plate_stock")).to.equal(true);
expect(ids.has("field_stim_mk0")).to.equal(true);
expect(ids.has("survey_drone_kit")).to.equal(true);
expect(ids.has("contract_handoff_token")).to.equal(true);
expect(ids.has("prototype_armor_shell")).to.equal(true);
});
test("scrap_metal_bulk row matches catalog", function () {
const body = res.getBody();
const row = body.items.find((x) => x.id === "scrap_metal_bulk");
expect(row).to.be.an("object");
expect(row.displayName).to.equal("Scrap Metal (Bulk)");
expect(row.prototypeRole).to.equal("material");
expect(row.stackMax).to.equal(999);
expect(row.inventorySlotKind).to.equal("bag");
});
}