Swiddis / word-debt-bot

A Discord bot for running a little reading game.
MIT License
2 stars 2 forks source link

Add more tests for main and error cog #33

Closed Swiddis closed 5 months ago

Swiddis commented 5 months ago

As part of reaching a personal goal of having 90%+ coverage, this PR adds unit tests for the bulk of the code in main, as well as some further tests for the new error cog, which together account for 40/63 missed lines. Also using this as an excuse to get some other refactoring work in.

Closes #34

Steps to complete:

codecov-commenter commented 5 months ago

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (d725946) 80.74% compared to head (0f99e43) 90.72%. Report is 2 commits behind head on dev.

Files Patch % Lines
src/word_debt_bot/main.py 60.00% 6 Missing :warning:
src/word_debt_bot/cogs/cmd_err_handler.py 84.21% 3 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #33 +/- ## ========================================== + Coverage 80.74% 90.72% +9.97% ========================================== Files 10 10 Lines 296 291 -5 ========================================== + Hits 239 264 +25 + Misses 57 27 -30 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Swiddis commented 5 months ago

Still haven't found much of a better system for the error tests, but the existing integration test framework does work with minimal modification (you still need to catch the correct error, but it still logs messages and manually running the bot verifies the errors aren't being logged). Will probably just keep using that in the future.