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

82 lines
2.9 KiB
Plaintext

meta {
name: GET recipe definitions
type: http
seq: 1
}
get {
url: {{baseUrl}}/game/world/recipe-definitions
body: none
auth: none
}
tests {
test("returns 200 JSON with schema v1 and recipes 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.recipes).to.be.an("array");
expect(body.recipes.length).to.equal(8);
});
test("recipes are ascending by id (ordinal)", function () {
const body = res.getBody();
const ids = body.recipes.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("frozen prototype eight matches registry id order", function () {
const body = res.getBody();
const ids = body.recipes.map((x) => x.id);
expect(ids).to.eql([
"make_armor_quick",
"make_contract_token",
"make_field_stim_batch",
"make_field_stim_mk0",
"make_prototype_armor",
"make_survey_drone_kit",
"refine_scrap_efficient",
"refine_scrap_standard",
]);
});
test("frozen prototype eight is present", function () {
const body = res.getBody();
const ids = new Set(body.recipes.map((x) => x.id));
expect(ids.has("make_armor_quick")).to.equal(true);
expect(ids.has("make_contract_token")).to.equal(true);
expect(ids.has("make_field_stim_batch")).to.equal(true);
expect(ids.has("make_field_stim_mk0")).to.equal(true);
expect(ids.has("make_prototype_armor")).to.equal(true);
expect(ids.has("make_survey_drone_kit")).to.equal(true);
expect(ids.has("refine_scrap_efficient")).to.equal(true);
expect(ids.has("refine_scrap_standard")).to.equal(true);
});
test("refine_scrap_standard row matches catalog", function () {
const body = res.getBody();
const row = body.recipes.find((x) => x.id === "refine_scrap_standard");
expect(row).to.be.an("object");
expect(row.displayName).to.equal("Refine Scrap (Standard)");
expect(row.recipeKind).to.equal("process");
expect(row.requiredSkillId).to.equal("refine");
expect(row.inputs).to.eql([{ itemId: "scrap_metal_bulk", quantity: 5 }]);
expect(row.outputs).to.eql([{ itemId: "refined_plate_stock", quantity: 1 }]);
});
test("make_field_stim_mk0 row matches catalog", function () {
const body = res.getBody();
const row = body.recipes.find((x) => x.id === "make_field_stim_mk0");
expect(row).to.be.an("object");
expect(row.recipeKind).to.equal("make");
expect(row.inputs).to.eql([
{ itemId: "refined_plate_stock", quantity: 2 },
{ itemId: "scrap_metal_bulk", quantity: 1 },
]);
expect(row.outputs).to.eql([{ itemId: "field_stim_mk0", quantity: 1 }]);
});
}