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

56 lines
1.9 KiB
Plaintext

meta {
name: GET encounter definitions
type: http
seq: 1
}
get {
url: {{baseUrl}}/game/world/encounter-definitions
body: none
auth: none
}
tests {
test("returns 200 JSON with schema v1 and encounters 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.encounters).to.be.an("array");
expect(body.encounters.length).to.equal(1);
});
test("encounters are ascending by id (ordinal)", function () {
const body = res.getBody();
const ids = body.encounters.map((x) => x.id);
// Match server StringComparer.Ordinal (prototype ids are ASCII snake_case).
const sorted = [...ids].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
expect(ids).to.eql(sorted);
});
test("prototype_combat_pocket row matches catalog", function () {
const body = res.getBody();
const row = body.encounters.find((x) => x.id === "prototype_combat_pocket");
expect(row).to.be.an("object");
expect(row.displayName).to.equal("Prototype Combat Pocket");
expect(row.completionCriteria).to.eql({ kind: "defeat_all_targets" });
expect(row.requiredNpcInstanceIds).to.eql([
"prototype_npc_melee",
"prototype_npc_ranged",
"prototype_npc_elite",
]);
});
test("nested rewardTable matches frozen grants", function () {
const body = res.getBody();
const row = body.encounters.find((x) => x.id === "prototype_combat_pocket");
expect(row.rewardTable).to.be.an("object");
expect(row.rewardTable.id).to.equal("prototype_combat_pocket_clear");
expect(row.rewardTable.displayName).to.equal("Prototype Combat Pocket Clear");
expect(row.rewardTable.fixedGrants).to.eql([
{ itemId: "scrap_metal_bulk", quantity: 10 },
{ itemId: "contract_handoff_token", quantity: 1 },
]);
});
}