brackt/app/services/__tests__
Chris Parsons 79f7a41837
Add Discord webhook notifications for standings updates (#157)
* Add Discord webhook notifications for standings updates

Adds a Discord webhook integration that posts standings to a configured
Discord channel whenever scores change after a scoring event. Commissioners
set the webhook URL in league settings and can send a test notification.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix Discord notification edge cases from code review

- Fix point delta sign: negative diffs now correctly show -5 pts not +-5 pts
- Replace hardcoded soccer emoji with a neutral bullet (works for all sports)
- Truncate embed description at Discord's 4096-char limit
- Thread eventId through processMatchResult and bracket batch handler so
  scored matches appear in single-match notifications too
- Pass eventName to finalizeQualifyingPoints ("Final Standings") and
  processSeasonStandings ("Season Complete") so those notifications have context
- Test notification now fetches current season to show "League 2025" format

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix process-match-result tests: add sportsSeasons to db mock

recalculateAffectedLeagues now queries sportsSeasons to get the sport
name for Discord notifications; the test mock db needed the stub added.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 11:16:36 -07:00
..
bracket-simulator.test.ts feat: implement Expected Value System with ICM probability calculator 2025-11-17 22:19:46 -08:00
discord.test.ts Add Discord webhook notifications for standings updates (#157) 2026-03-17 11:16:36 -07:00
ev-calculator.test.ts fix: align ev-calculator tests with decimal (0-1) probability format 2026-02-14 23:26:32 -08:00
icm-calculator.test.ts fix: correct test expectations for ICM edge cases and duplicate text queries 2026-02-17 14:24:07 -08:00
probability-engine.test.ts feat: implement Expected Value System with ICM probability calculator 2025-11-17 22:19:46 -08:00
probability-updater.test.ts feat: progressive floor scoring for playoff brackets (#100) 2026-03-10 10:27:58 -07:00