Release Healer Man 0.1.6
This commit is contained in:
@@ -65,6 +65,84 @@ test("serves the game and authenticated cloud-save API", async () => {
|
||||
});
|
||||
assert.equal(denied.status, 403);
|
||||
|
||||
const memberRegistration = await fetch(`${origin}/api/auth/register`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ username: "WebTank", password: "tanking-pass" }),
|
||||
});
|
||||
const memberAuth = await memberRegistration.json();
|
||||
const invited = await fetch(`${origin}/api/online-group/invite`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", Authorization: `Bearer ${auth.token}` },
|
||||
body: JSON.stringify({ username: "WebTank" }),
|
||||
});
|
||||
assert.equal(invited.status, 201);
|
||||
const memberGroupState = await (await fetch(`${origin}/api/online-group`, {
|
||||
headers: { Authorization: `Bearer ${memberAuth.token}` },
|
||||
})).json();
|
||||
assert.equal(memberGroupState.invitations.length, 1);
|
||||
const accepted = await fetch(`${origin}/api/online-group/invite/respond`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", Authorization: `Bearer ${memberAuth.token}` },
|
||||
body: JSON.stringify({ inviteId: memberGroupState.invitations[0].id, accept: true }),
|
||||
});
|
||||
assert.equal(accepted.status, 200);
|
||||
assert.equal((await accepted.json()).group.members.length, 2);
|
||||
|
||||
for (const [token, character, role] of [
|
||||
[auth.token, { id: "web-healer", name: "Mendara", classId: "priest", raceId: "human", gender: "female", level: 20 }, "healer"],
|
||||
[memberAuth.token, { id: "web-tank", name: "Bulwarka", classId: "warrior", raceId: "human", gender: "male", level: 20 }, "tank"],
|
||||
]) {
|
||||
const ready = await fetch(`${origin}/api/online-group/member`, {
|
||||
method: "PUT",
|
||||
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
||||
body: JSON.stringify({ character, role }),
|
||||
});
|
||||
assert.equal(ready.status, 200);
|
||||
}
|
||||
const activityResponse = await fetch(`${origin}/api/online-group/activity`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", Authorization: `Bearer ${auth.token}` },
|
||||
body: JSON.stringify({
|
||||
type: "dungeon",
|
||||
contentId: "wailing-caverns",
|
||||
fillWithAi: false,
|
||||
partySize: 2,
|
||||
}),
|
||||
});
|
||||
assert.equal(activityResponse.status, 200);
|
||||
const leaderSync = await fetch(`${origin}/api/online-session/sync`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", Authorization: `Bearer ${auth.token}` },
|
||||
body: JSON.stringify({
|
||||
afterEventId: 0,
|
||||
presence: { position: [1, 0, 2], health: 900, maxHealth: 1_000 },
|
||||
world: { mobs: { boss: { health: 500 } }, mobTransforms: {} },
|
||||
}),
|
||||
});
|
||||
assert.equal(leaderSync.status, 200);
|
||||
assert.equal((await leaderSync.json()).authority, true);
|
||||
const memberSync = await fetch(`${origin}/api/online-session/sync`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", Authorization: `Bearer ${memberAuth.token}` },
|
||||
body: JSON.stringify({
|
||||
afterEventId: 0,
|
||||
presence: { position: [3, 0, 4], health: 800, maxHealth: 1_000 },
|
||||
events: [{
|
||||
clientEventId: "web-tank-hit-1",
|
||||
kind: "damage",
|
||||
sourceActorId: `online-player:${memberAuth.account.id}`,
|
||||
targetActorId: "boss",
|
||||
rawAmount: 50,
|
||||
effectiveAmount: 45,
|
||||
}],
|
||||
}),
|
||||
});
|
||||
assert.equal(memberSync.status, 200);
|
||||
const memberSession = await memberSync.json();
|
||||
assert.equal(memberSession.players.length, 2);
|
||||
assert.equal(memberSession.events[0].targetActorId, "boss");
|
||||
|
||||
const gmRegistration = await fetch(`${origin}/api/auth/register`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
|
||||
Reference in New Issue
Block a user