Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 861 Bytes

README.md

File metadata and controls

18 lines (14 loc) · 861 Bytes

grammY with tests

This repository's purpose is to demonstrate how Telegram bots, developed with the help of grammY framework could be tested.

Explanation

It's assumed, that you configure complete bot logic in the bot.js file end then export it. So your bot can be imported in the __tests__/bot.test.js and tested.

During the tests we do not want our bot to interact with Telegram servers in any way. We can use transformer function which catches the outgoing requests. In our example, we record these outgoing requests, so later we can assert them.

How to run it

npm i
# run tests
npm test
# run bot
BOT_TOKEN=%YOUR_TOKEN% node start.js