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

70 lines
2.2 KiB
Plaintext

meta {
name: GET ability definitions
type: http
seq: 1
}
get {
url: {{baseUrl}}/game/world/ability-definitions
body: none
auth: none
}
tests {
test("returns 200 JSON with schema v1 and abilities 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.abilities).to.be.an("array");
expect(body.abilities.length).to.equal(4);
});
test("abilities are ascending by id (ordinal)", function () {
const body = res.getBody();
const ids = body.abilities.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.abilities.map((x) => x.id);
expect(ids).to.eql([
"prototype_burst",
"prototype_dash",
"prototype_guard",
"prototype_pulse",
]);
});
test("frozen prototype four is present", function () {
const body = res.getBody();
const ids = new Set(body.abilities.map((x) => x.id));
expect(ids.has("prototype_burst")).to.equal(true);
expect(ids.has("prototype_dash")).to.equal(true);
expect(ids.has("prototype_guard")).to.equal(true);
expect(ids.has("prototype_pulse")).to.equal(true);
});
test("prototype_pulse row matches catalog", function () {
const body = res.getBody();
const row = body.abilities.find((x) => x.id === "prototype_pulse");
expect(row).to.be.an("object");
expect(row.displayName).to.equal("Prototype Pulse");
expect(row.baseDamage).to.equal(25);
expect(row.cooldownSeconds).to.equal(3);
expect(row.abilityKind).to.equal("attack");
});
test("prototype_burst row matches catalog", function () {
const body = res.getBody();
const row = body.abilities.find((x) => x.id === "prototype_burst");
expect(row).to.be.an("object");
expect(row.displayName).to.equal("Prototype Burst");
expect(row.baseDamage).to.equal(40);
expect(row.cooldownSeconds).to.equal(5);
expect(row.abilityKind).to.equal("attack");
});
}