step 7.3: done
This commit is contained in:
@@ -360,4 +360,48 @@ describe('expeditions', () => {
|
||||
assert.equal(body.data.isFinished, true, 'should show finished after ends_at');
|
||||
assert.equal(body.data.timeRemaining, 0);
|
||||
});
|
||||
|
||||
// ─── GET /api/expeditions/defs ────────────────────────────────────────
|
||||
|
||||
it('returns all expedition definitions ordered by min_level', async () => {
|
||||
const { cookie } = await setupHero();
|
||||
|
||||
const res = await fetch(`${baseUrl}/api/expeditions/defs`, {
|
||||
headers: authHeaders(cookie),
|
||||
});
|
||||
const body = await res.json();
|
||||
|
||||
assert.equal(res.status, 200);
|
||||
assert.equal(body.ok, true);
|
||||
assert.ok(Array.isArray(body.data), 'should return an array');
|
||||
assert.equal(body.data.length, 3, 'should have 3 expedition definitions');
|
||||
|
||||
// First definition should be the lowest-level one.
|
||||
assert.equal(body.data[0].id, 1);
|
||||
assert.equal(body.data[0].minLevel, 1);
|
||||
assert.equal(body.data[0].name, 'Scout the Old Road');
|
||||
assert.equal(body.data[0].energyCost, 10);
|
||||
assert.equal(body.data[0].durationSec, 600);
|
||||
assert.equal(body.data[0].xpReward, 30);
|
||||
assert.equal(body.data[0].goldMin, 5);
|
||||
assert.equal(body.data[0].goldMax, 15);
|
||||
|
||||
// Second definition.
|
||||
assert.equal(body.data[1].id, 2);
|
||||
assert.equal(body.data[1].minLevel, 3);
|
||||
assert.equal(body.data[1].name, 'Raid the Bandit Camp');
|
||||
|
||||
// Third definition.
|
||||
assert.equal(body.data[2].id, 3);
|
||||
assert.equal(body.data[2].minLevel, 5);
|
||||
assert.equal(body.data[2].name, 'Delve the Hollow');
|
||||
});
|
||||
|
||||
it('rejects defs endpoint without authentication', async () => {
|
||||
const res = await fetch(`${baseUrl}/api/expeditions/defs`);
|
||||
const body = await res.json();
|
||||
|
||||
assert.equal(res.status, 401);
|
||||
assert.equal(body.ok, false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user