Currently, the API for defining commands provides a context object containing the whole Draupnir instance, a matrix client, and a few other utilities that cover a large API. All commands currently depend on different parts of this context object which complicates testing.
If we can break the dependencies down, like how we have done so for protections, then commands (and some Draupnir protections even) will become easier to unit test. This can be done by using a wrapper similar to the "capability context glue" trick that is used in MPS.
Acceptance Criteria
The ban, unban, kick, watch, unwatch commands all have unit tests, not integration tests.
Description
Currently, the API for defining commands provides a context object containing the whole Draupnir instance, a matrix client, and a few other utilities that cover a large API. All commands currently depend on different parts of this context object which complicates testing.
If we can break the dependencies down, like how we have done so for protections, then commands (and some Draupnir protections even) will become easier to unit test. This can be done by using a wrapper similar to the "capability context glue" trick that is used in MPS.
Acceptance Criteria
Pull requests