g4s8 / ghman

GitHub notifications Telegram bot manager
https://t.me/ghman_bot
Other
7 stars 4 forks source link

How to test a bot command or callback query? #12

Open victornoel opened 5 years ago

victornoel commented 5 years ago

In order to start working on #10, I need to be able to write a test but I have no idea how I can do that with teletakes.

I think the project should have a few tests for the existing code so that I can use it as an example.

A perfect one would be for click:notification in BotApp.

0crat commented 5 years ago

@g4s8/z please, pay attention to this issue

victornoel commented 5 years ago

@g4s8 or maybe a test for the command notifications is better, I don't know if the user can enter text with a callback query...

0crat commented 5 years ago

The job #12 assigned to @g4s8/z, here is why; the budget is 30 minutes, see §4; please, read §8 and §9; if the task is not clear, read this and this; there will be no monetary reward for this job

0crat commented 5 years ago

Manual assignment of issues is discouraged, see §19: -5 point(s) just awarded to @g4s8/z

0crat commented 5 years ago

Bug was reported, see §29: +15 point(s) just awarded to @victornoel/z

victornoel commented 5 years ago

@g4s8 can we get feedback on this?

For example, should/could we:

I don't really like the Mockito solution instead of using fake, so maybe we should introduce some ghman-oriented fakes for update instead?

Furthermore, I think we need something higher-level, a bit like takes' testing abstractions (see https://github.com/yegor256/takes#unit-testing).

victornoel commented 5 years ago

@g4s8 for the record, I went with fake Update object in #68 as an example.

g4s8 commented 5 years ago

@victornoel we can only use reflection/mockito for testing update, but it should be fixed with https://github.com/g4s8/teletakes/issues/10

victornoel commented 5 years ago

@g4s8 as I said in my previous https://github.com/g4s8/ghman/issues/12#issuecomment-511205841, we are not forced to only use reflection or mockito. I explained it a bit in https://github.com/g4s8/teletakes/issues/10#issuecomment-512448568