meta {
  name: GET skill definitions
  type: http
  seq: 1
}

get {
  url: {{baseUrl}}/game/world/skill-definitions
  body: none
  auth: none
}

tests {
  test("returns 200 JSON with schema v1 and skills 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.skills).to.be.an("array");
    expect(body.skills.length).to.equal(3);
  });

  test("skills are ascending by id (ordinal)", function () {
    const body = res.getBody();
    const ids = body.skills.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 trio is present", function () {
    const body = res.getBody();
    const ids = new Set(body.skills.map((x) => x.id));
    expect(ids.has("salvage")).to.equal(true);
    expect(ids.has("refine")).to.equal(true);
    expect(ids.has("intrusion")).to.equal(true);
  });

  test("salvage row matches catalog", function () {
    const body = res.getBody();
    const row = body.skills.find((x) => x.id === "salvage");
    expect(row).to.be.an("object");
    expect(row.displayName).to.equal("Salvage");
    expect(row.category).to.equal("gather");
    expect(row.allowedXpSourceKinds).to.include.members(["activity", "mission_reward"]);
  });
}
