Veto: Seitenwahl per Messerrunde, freie Messer-Server in der Lobby, Organisator legt fest, wer beginnt
This commit is contained in:
1 parent
7b6ce01d05
commit
cdf41df01c
9 files changed
+138
-8
No files matched your search
@@ -607,3 +607,44 @@ test('Map-Pools im Admin: Auswahl gilt für neue Matches, Veto passt sich an, la
|
||||
await close();
|
||||
}
|
||||
});
|
||||
test('Seitenwahl per Messerrunde: Organisator legt fest, wer das Veto beginnt', async () => {
|
||||
const { app, call, close } = await setup();
|
||||
try {
|
||||
const created = await call('POST', '/matches', { body: { teamA: 'Alpha', teamB: 'Bravo', mode: 'wingman', format: 'bo3', vetoStart: 'knife' } });
|
||||
assert.equal(created.status, 200, JSON.stringify(created.body));
|
||||
const { id, organizerToken: org } = created.body;
|
||||
const snap = (await call('GET', `/matches/${id}`, { token: org })).body;
|
||||
assert.equal(snap.vetoStart, 'knife');
|
||||
const codes = snap.organizer.codes;
|
||||
for (const [name, team] of [['a1', 'A'], ['a2', 'A'], ['b1', 'B'], ['b2', 'B']]) {
|
||||
const r = await call('POST', `/matches/${id}/join`, { body: { code: codes[team], nickname: name } });
|
||||
await call('POST', `/matches/${id}/ready`, { token: r.body.playerToken, body: { ready: true } });
|
||||
}
|
||||
// Ohne Angabe, wer beginnt, startet das Veto nicht
|
||||
const missing = await call('POST', `/matches/${id}/veto/start`, { token: org });
|
||||
assert.equal(missing.status, 400);
|
||||
assert.equal(missing.body.code, 'first_team_required');
|
||||
assert.equal((await call('POST', `/matches/${id}/veto/start`, { token: org, body: { firstTeam: 'X' } })).status, 400);
|
||||
|
||||
const ok = await call('POST', `/matches/${id}/veto/start`, { token: org, body: { firstTeam: 'B' } });
|
||||
assert.equal(ok.status, 200, JSON.stringify(ok.body));
|
||||
const after = (await call('GET', `/matches/${id}`, { token: org })).body;
|
||||
assert.equal(after.status, 'veto');
|
||||
assert.equal(after.veto.current.team, 'B', 'das gewählte Team beginnt');
|
||||
assert.ok(app.service.db.prepare("SELECT message FROM events WHERE match_id = ? AND message LIKE '%Messerrunde%'").get(id));
|
||||
} finally {
|
||||
await close();
|
||||
}
|
||||
});
|
||||
|
||||
test('Ohne Messerrunde bleibt firstTeam wirkungslos', async () => {
|
||||
const { call, close } = await setup();
|
||||
try {
|
||||
const { id, org, tokens } = await readyWingmanMatch(call, 'bo1');
|
||||
await call('POST', `/matches/${id}/veto/start`, { token: org, body: { firstTeam: 'B' } });
|
||||
const snap = (await call('GET', `/matches/${id}`, { token: tokens.a1 })).body;
|
||||
assert.equal(snap.veto.current.team, 'A', 'feste Startregel A gilt');
|
||||
} finally {
|
||||
await close();
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user