74 lines
2.1 KiB
Plaintext
74 lines
2.1 KiB
Plaintext
meta {
|
|
name: POST branch select deny branch already chosen
|
|
type: http
|
|
seq: 4
|
|
}
|
|
|
|
docs {
|
|
NEO-48: self-contained deny — pre-request grants salvage to level 2 and picks scrap_efficiency;
|
|
main request conflicts with bulk_haul on the same tier. Expects selected false + branch_already_chosen.
|
|
}
|
|
|
|
script:pre-request {
|
|
const axios = require("axios");
|
|
const baseUrl = bru.getEnvVar("baseUrl") || bru.getVar("baseUrl");
|
|
const playerId = bru.getEnvVar("playerId") || bru.getVar("playerId");
|
|
const jsonHeaders = { headers: { "Content-Type": "application/json" } };
|
|
const grant = await axios.post(
|
|
`${baseUrl}/game/players/${playerId}/skill-progression`,
|
|
{
|
|
schemaVersion: 1,
|
|
skillId: "salvage",
|
|
amount: 100,
|
|
sourceKind: "activity",
|
|
},
|
|
jsonHeaders,
|
|
);
|
|
if (grant.status !== 200) {
|
|
throw new Error(`salvage grant failed: ${grant.status}`);
|
|
}
|
|
const firstPick = await axios.post(
|
|
`${baseUrl}/game/players/${playerId}/perk-state`,
|
|
{
|
|
schemaVersion: 1,
|
|
skillId: "salvage",
|
|
tierIndex: 1,
|
|
branchId: "scrap_efficiency",
|
|
},
|
|
jsonHeaders,
|
|
);
|
|
if (firstPick.status !== 200 || firstPick.data?.selected !== true) {
|
|
throw new Error(`tier-1 pick failed: ${firstPick.status} ${JSON.stringify(firstPick.data)}`);
|
|
}
|
|
}
|
|
|
|
post {
|
|
url: {{baseUrl}}/game/players/{{playerId}}/perk-state
|
|
body: json
|
|
auth: none
|
|
}
|
|
|
|
body:json {
|
|
{
|
|
"schemaVersion": 1,
|
|
"skillId": "salvage",
|
|
"tierIndex": 1,
|
|
"branchId": "bulk_haul"
|
|
}
|
|
}
|
|
|
|
tests {
|
|
test("denies second pick with branch_already_chosen", function () {
|
|
expect(res.getStatus()).to.equal(200);
|
|
const body = res.getBody();
|
|
expect(body.schemaVersion).to.equal(1);
|
|
expect(body.selected).to.equal(false);
|
|
expect(body.reasonCode).to.equal("branch_already_chosen");
|
|
expect(body.unlockedEvents).to.be.an("array").that.is.empty;
|
|
const salvage = body.perkState.branchPicks.find((t) => t.skillId === "salvage");
|
|
expect(salvage).to.be.an("object");
|
|
const pick = salvage.picks.find((p) => p.tierIndex === 1);
|
|
expect(pick.branchId).to.equal("scrap_efficiency");
|
|
});
|
|
}
|