From a6a24ba4c9e9927a49a22d85f10f9e1b607f6893 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Mon, 6 Jul 2026 09:40:01 +0700 Subject: [PATCH] feat(lol): add EWC schedule support --- internal/modules/lol/format.go | 2 ++ internal/modules/lol/format_test.go | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/internal/modules/lol/format.go b/internal/modules/lol/format.go index 9a45e4b..bbf80a3 100644 --- a/internal/modules/lol/format.go +++ b/internal/modules/lol/format.go @@ -14,6 +14,7 @@ var leagueOrder = []string{ "worlds", "msi", "first_stand", + "ewc_lol", "lck", "lpl", "lec", @@ -34,6 +35,7 @@ var majorLeagueSlugs = map[string]bool{ "worlds": true, "msi": true, "first_stand": true, + "ewc_lol": true, "lcp": true, "cblol-brazil": true, "emea_masters": true, diff --git a/internal/modules/lol/format_test.go b/internal/modules/lol/format_test.go index 0ae9c65..386e019 100644 --- a/internal/modules/lol/format_test.go +++ b/internal/modules/lol/format_test.go @@ -90,19 +90,21 @@ func TestRenderToday_GroupsByLeagueInOrder(t *testing.T) { day := time.Date(2026, 5, 9, 0, 0, 0, 0, IctLocation) events := []ScheduleEvent{ mkEvent("unstarted", "lcs", "LCS", "TL", "C9", "2026-05-09T18:00:00Z"), + mkEvent("unstarted", "ewc_lol", "Esports World Cup", "GEN", "KC", "2026-05-09T09:00:00Z"), mkEvent("unstarted", "lck", "LCK", "T1", "GEN", "2026-05-09T05:00:00Z"), mkEvent("unstarted", "lpl", "LPL", "JDG", "BLG", "2026-05-09T08:00:00Z"), } got := RenderToday(events, day) - // LEAGUE_ORDER puts LCK before LPL before LCS. + // League order puts international events before regional leagues. + idxEwc := strings.Index(got, "Esports World Cup") idxLck := strings.Index(got, "LCK") idxLpl := strings.Index(got, "LPL") idxLcs := strings.Index(got, "LCS") - if idxLck < 0 || idxLpl < 0 || idxLcs < 0 { + if idxEwc < 0 || idxLck < 0 || idxLpl < 0 || idxLcs < 0 { t.Fatalf("missing league section; got:\n%s", got) } - if idxLck >= idxLpl || idxLpl >= idxLcs { - t.Errorf("league order wrong: lck=%d lpl=%d lcs=%d\n%s", idxLck, idxLpl, idxLcs, got) + if idxEwc >= idxLck || idxLck >= idxLpl || idxLpl >= idxLcs { + t.Errorf("league order wrong: ewc=%d lck=%d lpl=%d lcs=%d\n%s", idxEwc, idxLck, idxLpl, idxLcs, got) } // Header in ICT. if !strings.Contains(got, "LoL — Sat May 9 (ICT)") { @@ -145,10 +147,11 @@ func TestFilterMajor(t *testing.T) { {League: League{Slug: "tcl"}}, // Turkish league — not in allowlist {League: League{Slug: "lja"}}, // Japan academy — not in allowlist {League: League{Slug: "msi"}}, + {League: League{Slug: "ewc_lol"}}, } got := FilterMajor(events) - if len(got) != 3 { - t.Errorf("filtered count = %d, want 3", len(got)) + if len(got) != 4 { + t.Errorf("filtered count = %d, want 4", len(got)) } for _, e := range got { if e.League.Slug == "tcl" || e.League.Slug == "lja" {