48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
meta {
|
|
name: GET combat targets
|
|
type: http
|
|
seq: 1
|
|
}
|
|
|
|
get {
|
|
url: {{baseUrl}}/game/world/combat-targets
|
|
body: none
|
|
auth: none
|
|
}
|
|
|
|
tests {
|
|
test("returns 200 JSON with schema v1 and targets 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.targets).to.be.an("array");
|
|
expect(body.targets.length).to.equal(2);
|
|
});
|
|
|
|
test("targets are ascending by targetId (ordinal)", function () {
|
|
const body = res.getBody();
|
|
const ids = body.targets.map((x) => x.targetId);
|
|
const sorted = [...ids].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
|
|
expect(ids).to.eql(sorted);
|
|
});
|
|
|
|
test("prototype registry targets match id order", function () {
|
|
const body = res.getBody();
|
|
const ids = body.targets.map((x) => x.targetId);
|
|
expect(ids).to.eql([
|
|
"prototype_target_alpha",
|
|
"prototype_target_beta",
|
|
]);
|
|
});
|
|
|
|
test("both targets start at full HP on fresh server", function () {
|
|
const body = res.getBody();
|
|
for (const row of body.targets) {
|
|
expect(row.maxHp).to.equal(100);
|
|
expect(row.currentHp).to.equal(100);
|
|
expect(row.defeated).to.equal(false);
|
|
}
|
|
});
|
|
}
|