CLIxIndia-Dev / CLIxIndia-Dev/MiTiRobot
Functional testing
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
So ... I was thinking about this and how you could modularize `on_chat_message` and write unit tests, but I think before you do that, it would be better to have functional tests, to make sure that modularizing and writing unit tests doesn't break the overall behavior. Using a `mock` [library](https://docs.python.org/3/library/unittest.mock.html), I suggest creating some high-level functional tests -- I think it will save a lot of headache down the road, to make sure the code still works the same way post-refactor. So a bunch of tests around `geturl` and `on_chat_message` covering the main use cases would be good. The easiest way to do that is probably capture the JSON request bodies for some actual requests (using dev console or print statements or curl), stick those into some test `json` files that you load in the `setUp` of the test, create [test fixtures for a message tree](http://django-testing-docs.readthedocs.io/en/latest/fixtures.html), and then make sure the correct Telegram APIs are called (mock out the `bot`).
I'm not sure how detailed to make these tests, since ideally I think the longish-term goal would be to write smaller unit tests for individual pieces of functionality (once we break it into smaller methods), but you want these functional tests to cover enough ground that you feel confident in moving around chunks of code without breaking anything...
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the geturl and on_chat_message entry points and reviewing how message-tree fixtures and test setUp are handled. Capture representative JSON request bodies, load them as fixtures, mock the bot, and add functional coverage for the main use cases while verifying the expected Telegram API calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100