Map-Pools: Overpass, Vertigo und Cache für Competitive, Map-Auswahl im Admin, Veto-Ablauf passend zur Map-Anzahl

This commit is contained in:
mregosar committed 2026-10-29 21:03:29 +01:00
1 parent e3834bb071
commit 2d65634d6e
13 files changed
+459 -45

No files matched your search

+33
View File
@@ -574,3 +574,36 @@ test('Messer-Server: nur Admin startet, Startseite sieht laufende, Ports zählen
await close();
}
});
test('Map-Pools im Admin: Auswahl gilt für neue Matches, Veto passt sich an, laufende Matches behalten ihre Maps', async () => {
const { app, call, close } = await setup({ adminPassword: 'admin-geheim' });
try {
const token = (await call('POST', '/admin/login', { body: { password: 'admin-geheim' } })).body.token;
const before = (await call('POST', '/matches', { body: { teamA: 'Vorher A', teamB: 'Vorher B', mode: 'competitive', format: 'bo3' } })).body;
const view = (await call('GET', '/admin/map-pools', { token })).body;
const comp = view.pools.find((p) => p.mode === 'competitive');
assert.ok(['de_overpass', 'de_vertigo', 'de_cache'].every((id) => comp.maps.some((m) => m.id === id && m.active)));
// Nur 5 Maps: BO5 geht noch, BO3 hat dann 2 Bans
const five = ['de_cache', 'de_dust2', 'de_inferno', 'de_mirage', 'de_nuke'];
const saved = await call('PUT', '/admin/map-pools', { token, body: { mode: 'competitive', maps: five } });
assert.equal(saved.status, 200, JSON.stringify(saved.body));
const pool = saved.body.pools.find((p) => p.mode === 'competitive');
assert.equal(pool.maps.filter((m) => m.active).length, 5);
assert.deepEqual(pool.formats.bo3.flow, ['ban:X', 'ban:Y', 'pick:X', 'side:Y', 'pick:Y', 'side:X', 'decider', 'side:X']);
// Neue Matches bekommen die neue Auswahl, das alte behält seine 10 Maps
const after = (await call('POST', '/matches', { body: { teamA: 'Nachher A', teamB: 'Nachher B', mode: 'competitive', format: 'bo3' } })).body;
assert.equal(JSON.parse(app.service.getMatch(after.id).maps).length, 5);
assert.equal(JSON.parse(app.service.getMatch(before.id).maps).length, 10);
// Öffentliche Konfiguration (Match erstellen) zeigt die neuen Formate
const cfg = (await call('GET', '/config')).body;
assert.equal(cfg.pools.find((p) => p.mode === 'competitive').maps.length, 5);
// Ungültig: zu wenige oder unbekannte Maps
assert.equal((await call('PUT', '/admin/map-pools', { token, body: { mode: 'competitive', maps: ['de_cache'] } })).status, 400);
assert.equal((await call('PUT', '/admin/map-pools', { token, body: { mode: 'competitive', maps: ['de_cache', 'de_foo'] } })).status, 400);
assert.equal((await call('PUT', '/admin/map-pools', { body: { mode: 'competitive', maps: five } })).status, 401);
} finally {
await close();
}
});