mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-06-02 22:26:57 -05:00
Throw an error in map list generation if duplicate maps
This commit is contained in:
parent
7d08d184ca
commit
768fc62b2c
|
|
@ -763,5 +763,32 @@ TournamentMapListGeneratorOneMode(
|
|||
}
|
||||
);
|
||||
|
||||
TournamentMapListGeneratorOneMode(
|
||||
"Throws if duplicate maps in the pool",
|
||||
() => {
|
||||
assert.throws(
|
||||
() =>
|
||||
generateMaps({
|
||||
teams: [
|
||||
{
|
||||
id: 1,
|
||||
maps: new MapPool([
|
||||
{ mode: "SZ", stageId: 1 },
|
||||
{ mode: "SZ", stageId: 1 },
|
||||
]),
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
maps: new MapPool([]),
|
||||
},
|
||||
],
|
||||
modesIncluded: ["SZ"],
|
||||
}),
|
||||
(err: Error) => err.message.includes("Duplicate map"),
|
||||
"Expected error to be thrown about duplicate maps"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
TournamentMapListGenerator.run();
|
||||
TournamentMapListGeneratorOneMode.run();
|
||||
|
|
|
|||
|
|
@ -163,6 +163,17 @@ export function createTournamentMapList(
|
|||
),
|
||||
"Maps submitted for modes not included in the tournament"
|
||||
);
|
||||
|
||||
for (const team of input.teams) {
|
||||
const stringified = team.maps.stageModePairs.map(
|
||||
(p) => `${p.stageId}-${p.mode}`
|
||||
);
|
||||
const unique = new Set(stringified);
|
||||
invariant(
|
||||
unique.size === stringified.length,
|
||||
`Duplicate maps in map pool (team ${team.id})`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function utilizeOtherStageIdsWhenNoTiebreaker() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user