You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am aware that we can not cover the actual JDA integration but we should still test the application logic of our commands in an isolated fashion with unit tests.
@Heatmanofurioso proposed a JdaMock class using Mockito that tries to integrate into our existing command system for some sort of natural testing. You can get the proposed changes as PATCH file here and there is also the branch feature/add_jda_mock with all those change in them already.
Before we get started, we have to decide and align on how we want to approach this, whether a JdaMock is a good idea or maybe not. And then we have to create and/or polish a solution and finally at least add some tests for the base commands (ping, dbget, dbput, as shown by @Heatmanofurioso in the proposal).
When we create a wiki for this, we should clarify it excessively that people should still test their commands on Discord.
A lot isn't getting checked when you mock (a.e command registration), things on Discord ends like not all permissions
We can try to mock command registration, but I'm not sure about the accuracy of everything
Agreed. Still, I do see a big benefit in having tests covering at least the command logic itself. Like, lets say a /add 10 7 command should spit out 17. We can easily add tests for that.
Then, if someone edits the logic in the future, the test will give him confidence that he did not break the actual logic. He should of course still test it out on the real Discord to get in JDA issues, for sure. I totally agree to that!
Activity
Tais993 commentedon Oct 11, 2021
When we create a wiki for this, we should clarify it excessively that people should still test their commands on Discord.
A lot isn't getting checked when you mock (a.e command registration), things on Discord ends like not all permissions
We can try to mock command registration, but I'm not sure about the accuracy of everything
Zabuzard commentedon Oct 11, 2021
Agreed. Still, I do see a big benefit in having tests covering at least the command logic itself. Like, lets say a
/add 10 7command should spit out17. We can easily add tests for that.Then, if someone edits the logic in the future, the test will give him confidence that he did not break the actual logic. He should of course still test it out on the real Discord to get in JDA issues, for sure. I totally agree to that!
Tais993 commentedon Oct 11, 2021
👍