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

73 lines
2.4 KiB
Plaintext

meta {
name: GET quest definitions
type: http
seq: 1
}
get {
url: {{baseUrl}}/game/world/quest-definitions
body: none
auth: none
}
tests {
test("returns 200 JSON with schema v1 and quests 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.quests).to.be.an("array");
expect(body.quests.length).to.equal(5);
});
test("quests are ascending by id (ordinal)", function () {
const body = res.getBody();
const ids = body.quests.map((x) => x.id);
const sorted = [...ids].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
expect(ids).to.eql(sorted);
});
test("prototype_quest_gather_intro row matches catalog", function () {
const body = res.getBody();
const row = body.quests.find((x) => x.id === "prototype_quest_gather_intro");
expect(row).to.be.an("object");
expect(row.displayName).to.equal("Intro: Salvage Run");
expect(row.prerequisiteQuestIds).to.eql([]);
expect(row.steps).to.have.length(1);
expect(row.steps[0].objectives[0]).to.eql({
id: "gather_intro_obj_scrap",
kind: "gather_item",
itemId: "scrap_metal_bulk",
quantity: 3,
});
});
test("prototype_quest_operator_chain has four steps and terminal token objective", function () {
const body = res.getBody();
const row = body.quests.find((x) => x.id === "prototype_quest_operator_chain");
expect(row).to.be.an("object");
expect(row.steps).to.have.length(4);
expect(row.steps[3].objectives[0]).to.eql({
id: "chain_obj_token",
kind: "inventory_has_item",
itemId: "contract_handoff_token",
quantity: 1,
});
});
test("prototype_quest_grid_contract has operator-chain prereq and kit hand-in objective", function () {
const body = res.getBody();
const row = body.quests.find((x) => x.id === "prototype_quest_grid_contract");
expect(row).to.be.an("object");
expect(row.displayName).to.equal("Grid Contract");
expect(row.prerequisiteQuestIds).to.eql(["prototype_quest_operator_chain"]);
expect(row.steps).to.have.length(1);
expect(row.steps[0].objectives[0]).to.eql({
id: "grid_contract_obj_kit",
kind: "inventory_has_item",
itemId: "survey_drone_kit",
quantity: 1,
});
});
}