mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 00:14:00 +00:00
test(server): seed a seasons row for the ranked rollover integration test
ranked_season_rollovers.season_id has a foreign key into seasons, but the integration test never inserted a seasons row for 'season-1' -- ApplyRankedSeasonRollover failed on the FK constraint before the rollover logic itself ran at all. Insert a matching seasons row, mirroring how a real 12-week season would already exist when maintenance's rollover sweep runs. Verified against a real PostgreSQL instance.
This commit is contained in:
@@ -446,6 +446,9 @@ func TestPostgreSQLRankedSeasonRolloverIsExactlyOnce(t *testing.T) {
|
||||
if _, err := db.ExecContext(ctx, `INSERT INTO ratings (player_id, rating, deviation, volatility, ranked_games) VALUES ('season-player', 1900, 100, 0.12, 25)`); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := db.ExecContext(ctx, `INSERT INTO seasons (season_id, playlist, starts_at, ends_at) VALUES ('season-1', 'ranked', $1, $2)`, now.Add(-12*7*24*time.Hour), now); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
profile := domain.RankedProfile{Rating: domain.Rating{Value: 1900, RD: 100, Volatility: 0.12}, RankedGames: 25}
|
||||
updated, applied, err := ApplyRankedSeasonRollover(ctx, db, "season-player", "season-1", profile, now)
|
||||
if err != nil || !applied {
|
||||
|
||||
Reference in New Issue
Block a user