neon-sprawl/bruno/neon-sprawl-server/interaction/Get interactables list.bru

56 lines
1.7 KiB
Plaintext

meta {
name: GET interactables list
type: http
seq: 9
}
get {
url: {{baseUrl}}/game/world/interactables
body: none
auth: none
}
tests {
test("returns 200 JSON with schema v1 and interactables 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.interactables).to.be.an("array");
expect(body.interactables.length).to.be.at.least(2);
});
test("interactables are ascending by interactableId", function () {
const body = res.getBody();
const ids = body.interactables.map((x) => x.interactableId);
const sorted = [...ids].sort((a, b) => a.localeCompare(b));
expect(ids).to.eql(sorted);
});
test("prototype_resource_node_alpha row matches registry", function () {
const body = res.getBody();
const row = body.interactables.find(
(x) => x.interactableId === "prototype_resource_node_alpha"
);
expect(row).to.be.an("object");
expect(row.kind).to.equal("resource_node");
expect(row.anchor.x).to.equal(12);
expect(row.anchor.y).to.equal(0.5);
expect(row.anchor.z).to.equal(-6);
expect(row.interactionRadius).to.equal(3);
});
test("prototype_terminal row matches registry", function () {
const body = res.getBody();
const row = body.interactables.find(
(x) => x.interactableId === "prototype_terminal"
);
expect(row).to.be.an("object");
expect(row.kind).to.equal("terminal");
expect(row.anchor.x).to.equal(0);
expect(row.anchor.y).to.equal(0.5);
expect(row.anchor.z).to.equal(0);
expect(row.interactionRadius).to.equal(3);
});
}