64 lines
1.6 KiB
Plaintext
64 lines
1.6 KiB
Plaintext
meta {
|
|
name: POST interact depleted node deny
|
|
type: http
|
|
seq: 13
|
|
}
|
|
|
|
docs {
|
|
NEO-63: uses prototype_urban_bulk_delta (not alpha) so earlier interaction requests in this collection do not pre-deplete capacity. Pre-request exhausts the node (10 successful gathers), then this interact should deny with node_depleted.
|
|
}
|
|
|
|
script:pre-request {
|
|
const axios = require("axios");
|
|
const baseUrl = bru.getEnvVar("baseUrl") || bru.getVar("baseUrl");
|
|
const playerId = bru.getEnvVar("playerId") || bru.getVar("playerId");
|
|
const nodeId = "prototype_urban_bulk_delta";
|
|
await axios.post(
|
|
`${baseUrl}/game/players/${playerId}/move`,
|
|
{
|
|
schemaVersion: 1,
|
|
target: { x: 16, y: 0.9, z: 0 },
|
|
},
|
|
{ headers: { "Content-Type": "application/json" } },
|
|
);
|
|
for (let i = 0; i < 10; i++) {
|
|
const res = await axios.post(
|
|
`${baseUrl}/game/players/${playerId}/interact`,
|
|
{
|
|
schemaVersion: 1,
|
|
interactableId: nodeId,
|
|
},
|
|
{ headers: { "Content-Type": "application/json" } },
|
|
);
|
|
if (!res.data.allowed) {
|
|
throw new Error(`expected gather ${i + 1}/10 to succeed, got ${res.data.reasonCode}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/game/players/{{playerId}}/interact
|
|
body: json
|
|
auth: none
|
|
}
|
|
|
|
headers {
|
|
content-type: application/json
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"schemaVersion": 1,
|
|
"interactableId": "prototype_urban_bulk_delta"
|
|
}
|
|
}
|
|
|
|
tests {
|
|
test("depleted node interact denied with node_depleted", function () {
|
|
expect(res.getStatus()).to.equal(200);
|
|
const body = res.getBody();
|
|
expect(body.allowed).to.equal(false);
|
|
expect(body.reasonCode).to.equal("node_depleted");
|
|
});
|
|
}
|