test(tg): grammY integration smoke tests via mocked api transport#21
Merged
BlindMaster24 merged 2 commits intoApr 27, 2026
Merged
Conversation
98592de to
ece7ce0
Compare
f8a264d to
ad1a2e1
Compare
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
ad1a2e1 to
25c76f2
Compare
2ea611c to
8d23d88
Compare
3e0007a to
bdd6845
Compare
17e010f
into
devin/1777025566-graceful-shutdown
8 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a focused smoke suite for the grammY framework bindings so upstream grammY bumps (and future Renovate PRs) surface breakage before it lands in prod, without requiring a real Telegram token or network calls.
Why: the existing
tests/bots/telegram-flow.test.tsonly checks command regexps in isolation. We had zero coverage of the grammYBotinstance itself — so a breaking 1.x → 2.x API change (request transformer signature, update routing, error boundary) would have silently passed CI until a real deploy.What's new (
tests/bots/grammy-smoke.test.ts):new Bot(...)with a presetbotInfo(skipsgetMe) and swaps the API transport viabot.api.config.use(...)to record every outbound call without hitting Telegram./starttext update is routed to itsbot.hears(...)handler and the reply lands as asendMessagecall with the right chat id + textBotErrorwith the original error attached on.error— catches the contract we rely on fortg_update_handler_errorlogging insrc/services/bots/tg/index.tsbot.command('ics', ...)with a realisticentities: [{ type: 'bot_command', ... }]payload fires the handler and sends the replyNo prod code change.
Checks:
pnpm run test:all— 33 files / 214 tests passpnpm run ts-check/pnpm run lint/pnpm run format:check— cleanpnpm audit --audit-level=low— no known vulnerabilitiesRun the new tests with:
pnpm exec vitest run tests/bots/grammy-smoke.test.tsStacked on PR #20.
Review & Testing Checklist for Human
pnpm add grammy@2) and runpnpm exec vitest run tests/bots/grammy-smoke.test.ts— the suite should break loudly if the transport or error-boundary contracts change.pnpm run test:allfrom a fresh checkout to confirm nothing flaky.Notes
BotService→ChatDB round-trip → keyboard rendering) isn't in scope here — it would require an in-memory Sequelize fixture and the whole service dependency graph bootstrapped per test. Can be added as a follow-up if the smoke layer starts missing regressions.Link to Devin session: https://app.devin.ai/sessions/7732f5fd16e9448295cbabeb8b5f471a
Requested by: @BlindMaster24