neon-sprawl/bruno/neon-sprawl-server/resource-node-definitions/Get resource node definitio...

70 lines
2.3 KiB
Plaintext

meta {
name: GET resource node definitions
type: http
seq: 1
}
get {
url: {{baseUrl}}/game/world/resource-node-definitions
body: none
auth: none
}
tests {
test("returns 200 JSON with schema v1 and nodes 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.nodes).to.be.an("array");
expect(body.nodes.length).to.equal(4);
});
test("nodes are ascending by id (ordinal)", function () {
const body = res.getBody();
const ids = body.nodes.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 four matches registry id order", function () {
const body = res.getBody();
const ids = body.nodes.map((x) => x.id);
expect(ids).to.eql([
"prototype_bio_mat_gamma",
"prototype_resource_node_alpha",
"prototype_subsurface_vein_beta",
"prototype_urban_bulk_delta",
]);
});
test("frozen prototype four is present", function () {
const body = res.getBody();
const ids = new Set(body.nodes.map((x) => x.id));
expect(ids.has("prototype_bio_mat_gamma")).to.equal(true);
expect(ids.has("prototype_resource_node_alpha")).to.equal(true);
expect(ids.has("prototype_subsurface_vein_beta")).to.equal(true);
expect(ids.has("prototype_urban_bulk_delta")).to.equal(true);
});
test("prototype_resource_node_alpha row matches catalog", function () {
const body = res.getBody();
const row = body.nodes.find((x) => x.id === "prototype_resource_node_alpha");
expect(row).to.be.an("object");
expect(row.displayName).to.equal("Prototype Salvage Heap");
expect(row.gatherLens).to.equal("consumer_salvage");
expect(row.maxGathers).to.equal(10);
expect(row.yield).to.be.an("object");
expect(row.yield.itemId).to.equal("scrap_metal_bulk");
expect(row.yield.quantity).to.equal(1);
});
test("prototype_urban_bulk_delta yield quantity matches catalog", function () {
const body = res.getBody();
const row = body.nodes.find((x) => x.id === "prototype_urban_bulk_delta");
expect(row).to.be.an("object");
expect(row.gatherLens).to.equal("urban_bulk");
expect(row.yield.quantity).to.equal(5);
});
}