Release v0.1.20 2026-07-19
This commit is contained in:
@@ -228,6 +228,7 @@ test("Healing Hockey PVP queue pairs players and relays match snapshots", async
|
||||
assert.equal(betaQueue.body.status, "matched");
|
||||
assert.equal(betaQueue.body.match.role, "guest");
|
||||
assert.equal(betaQueue.body.match.opponentName, "Alpha");
|
||||
assert.equal(betaQueue.body.match.generation, 1);
|
||||
assert.ok(betaQueue.body.match.countdownEndsAtMs > Date.now());
|
||||
|
||||
const alphaMatched = await json(`/api/hockey-pvp/queue/${alphaQueue.body.ticketId}`, {
|
||||
@@ -237,21 +238,62 @@ test("Healing Hockey PVP queue pairs players and relays match snapshots", async
|
||||
assert.equal(alphaMatched.body.match.role, "host");
|
||||
assert.equal(alphaMatched.body.match.id, betaQueue.body.match.id);
|
||||
assert.equal(alphaMatched.body.match.seed, betaQueue.body.match.seed);
|
||||
assert.equal(alphaMatched.body.match.generation, betaQueue.body.match.generation);
|
||||
assert.equal(alphaMatched.body.match.countdownEndsAtMs, betaQueue.body.match.countdownEndsAtMs);
|
||||
|
||||
const hostSnapshot = { sequence: 1, party: [], puck: { goalSequence: 0 } };
|
||||
await json(`/api/hockey-pvp/matches/${alphaMatched.body.match.id}/state`, {
|
||||
method: "PUT",
|
||||
headers: { Authorization: `Bearer ${alphaToken}`, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ snapshot: hostSnapshot }),
|
||||
body: JSON.stringify({ generation: 1, snapshot: hostSnapshot }),
|
||||
});
|
||||
const guestExchange = await json(`/api/hockey-pvp/matches/${alphaMatched.body.match.id}/state`, {
|
||||
method: "PUT",
|
||||
headers: { Authorization: `Bearer ${betaToken}`, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ snapshot: { sequence: 1, party: [] } }),
|
||||
body: JSON.stringify({ generation: 1, snapshot: { sequence: 1, party: [] } }),
|
||||
});
|
||||
assert.deepEqual(guestExchange.body.opponentSnapshot, hostSnapshot);
|
||||
assert.deepEqual(guestExchange.body.hostSnapshot, hostSnapshot);
|
||||
|
||||
const alphaRematchWaiting = await json(`/api/hockey-pvp/matches/${alphaMatched.body.match.id}/rematch`, {
|
||||
method: "POST",
|
||||
headers: { Authorization: `Bearer ${alphaToken}`, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ generation: 1 }),
|
||||
});
|
||||
assert.equal(alphaRematchWaiting.body.status, "waiting");
|
||||
|
||||
const betaRematchReady = await json(`/api/hockey-pvp/matches/${alphaMatched.body.match.id}/rematch`, {
|
||||
method: "POST",
|
||||
headers: { Authorization: `Bearer ${betaToken}`, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ generation: 1 }),
|
||||
});
|
||||
assert.equal(betaRematchReady.body.status, "matched");
|
||||
assert.equal(betaRematchReady.body.match.generation, 2);
|
||||
assert.ok(betaRematchReady.body.match.countdownEndsAtMs > Date.now());
|
||||
|
||||
const alphaRematchReady = await json(`/api/hockey-pvp/matches/${alphaMatched.body.match.id}/rematch`, {
|
||||
method: "POST",
|
||||
headers: { Authorization: `Bearer ${alphaToken}`, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ generation: 1 }),
|
||||
});
|
||||
assert.equal(alphaRematchReady.body.status, "matched");
|
||||
assert.equal(alphaRematchReady.body.match.generation, 2);
|
||||
assert.equal(alphaRematchReady.body.match.seed, betaRematchReady.body.match.seed);
|
||||
assert.equal(alphaRematchReady.body.match.countdownEndsAtMs, betaRematchReady.body.match.countdownEndsAtMs);
|
||||
|
||||
const staleExchange = await json(`/api/hockey-pvp/matches/${alphaMatched.body.match.id}/state`, {
|
||||
method: "PUT",
|
||||
headers: { Authorization: `Bearer ${alphaToken}`, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ generation: 1, snapshot: hostSnapshot }),
|
||||
});
|
||||
assert.equal(staleExchange.response.status, 409);
|
||||
|
||||
const freshExchange = await json(`/api/hockey-pvp/matches/${alphaMatched.body.match.id}/state`, {
|
||||
method: "PUT",
|
||||
headers: { Authorization: `Bearer ${alphaToken}`, "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ generation: 2, snapshot: hostSnapshot }),
|
||||
});
|
||||
assert.equal(freshExchange.response.status, 200);
|
||||
});
|
||||
|
||||
test("invalid credentials cannot access server saves", async () => {
|
||||
|
||||
Reference in New Issue
Block a user