Repository navigation
Open
Description
tg runs the paths below, but no offline test (bun run test or bun run test:e2e) covers them. A few are covered only by the opt-in live suite, src/test/telegram.integration.test.ts. I checked each one on main at 649eef9 by grepping the tests for it.
Send (src/commands/send.ts, src/commands/send/)
- The
USER_IS_BOTandCHAT_WRITE_FORBIDDENmessages oftg send.send.test.tscovers a local recipient error and theRICH_MESSAGE_hints, but not these two. - The output of a successful
tg send --file(file: { name, mimeType, size, sentAs }andattachment), and how the command wires insendFile. Only the live suite covers them.send-file.e2e.test.tscovers argument errors, andsend-file.test.tscoverssendFileandsentAttachmenton their own. extractMessageInfofor anupdateShortSentMessageresult and forupdateMessageID. The results insend.test.tsall carryupdateNewMessage.send-cache.test.tscovers both shapes, but for a different function: the cache write.
Read commands (src/commands/user/, src/commands/chats/, src/commands/contacts.ts)
tg user @usernameandtg user +phonethrough Telegram, inuser/lookup.tsanduser/helpers.ts: the identifier kinds, phone normalisation,contacts.resolveUsernameandcontacts.resolvePhone, and theUSERNAME_NOT_OCCUPIEDandPHONE_NOT_OCCUPIEDmessages.user.test.tscovers only a user ID with--fresh.tg mefrom the API (user/me.ts), with--freshor on a first run:getMe, the cache write, and storing the account'suser_id. Also the background refresh of a stale cachedme, andAUTH_REQUIREDwhengetMefails. Tests readmeonly from the cache (multi-account.e2e.test.ts).tg chats list --freshon a cache that already holds chats, and the--type/--unreadfilters on the API path (filterChatsByType), inchats/list.ts.chats.test.tscovers onlyfetchChatsFromApi.tg chats get --fresh @username(fetchChatFromApiinchats/get.ts).commands.e2e.test.tscovers only the refusal of--freshwith an ID.- The API paths of
tg contacts searchandtg contacts get.contacts.test.tscovers onlycontacts list --fresh.
SQL and status (src/commands/sql/query.ts, src/commands/status.ts)
tg sql --limit N, and the default of 1000, run through the command.applyQueryLimitand the refusal of an invalid limit are tested; nothing checks that the command applies the limit.tg statuslists at most 5 pending jobs (getPendingJobs().slice(0, 5)).status.e2e.test.tstests that cap only for failed jobs.
Daemon (src/daemon/)
- The shutdown timeout in
cleanupWithTimeout(daemon.ts): warn, release the PID file, exit 1. The test context setsshutdownTimeoutMsto 1,000,000. - What
onEditMessageinsetupEventHandlers(daemon-accounts.ts) passes tohandleEditMessage: the text, falling back to rich text, and the edit date.daemon-accounts.connect.test.tsonly counts the handlers, andupdate-handlers.test.tstestshandleEditMessageon its own. - SIGINT.
daemon-accounts.test.tstests only the SIGTERM handler.
Storage (src/db/index.ts)
- data.db's own upgrades in
initSchema. These are theALTER TABLE accounts ADD COLUMNsteps foruser_id,usernameandlabel, andmigrateAndResolveDuplicates. That function gives auser:<id>phone itsuser_id, or deletes the row when another account already has thatuser_id. Every test creates data.db with the current schema.
Search and account selection
--phrasetogether with--snippetintg messages search: the command passesphrasetosnippetTerms(src/commands/messages/search.ts), but no e2e test runs both flags.snippetTermsitself is unit-tested.- An empty
--account "", which fails withINVALID_ARGS("Account selector cannot be empty"), and an--account @usernamethat matches no account, which fails withACCOUNT_NOT_FOUND. Both are inresolveAccountSelector(src/utils/account-selector.ts). The tests cover a missing ID and a missing label. Both cases behave correctly on main; there's just no test for either.
Metadata
Metadata
Assignees
Labels
No labels
Activity