Page MenuHomePhabricator

[alias-server] Initialize telegram bot in index.js and pass as function parameter to websocket functions
ClosedPublic

Authored by bytesofman on Apr 4 2023, 10:38.

Details

Summary

T3060

Initializing the telegram bot creates a polling telegram bot. If this is done in any unit tests, the unit test will hang indefinitely and not resolve.

Initialize the telegram bot from index.js on app startup and pass as a param. In this way, you can mock it for unit tests, or create unit tests that do not depend on the telegram bot.

Test Plan

Confirm no lint errors related to parameter redefinition
node index.js and nothing breaks

Diff Detail

Repository
rABC Bitcoin ABC
Branch
alias-server-move-tg-initialization
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22949
Build 45518: Build Diffalias-server-tests
Build 45517: arc lint + arc unit

Event Timeline

Fabien retitled this revision from [alias-server] Initialize telegram bot in index.js and pass as function paramater to websocket functions to [alias-server] Initialize telegram bot in index.js and pass as function parameter to websocket functions.
This revision is now accepted and ready to land.Apr 4 2023, 14:07