Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests for /remind #415

Merged
merged 3 commits into from
May 9, 2022
Merged

Unit tests for /remind #415

merged 3 commits into from
May 9, 2022

Conversation

Zabuzard
Copy link
Member

@Zabuzard Zabuzard commented Mar 15, 2022

Overview

Implements and closes #396.

Adds unit tests for /remind. And while doing so, greatly enhances the capabilities of our JDA mocking suite.

Also, this fixes a minor bug with /remind mixing reminders across guilds.

Unit tests

The tests for RemindCommand cover:

  • create reminders
  • throws for unsupported unit
  • refuses for dates too far in future
  • user is limited if sending too many reminders
  • user is not limited if other user hit the limit

The tests for RemindRoutine cover:

  • send reminder in guild
  • send reminder in guild, user unknown
  • send reminder in DM
  • skip reminder if error
  • dont send non-pending reminders

JDA mocking suite

The enhancements to the test suite are:

  • support for OptionType.INTEGER in slash command event builder
  • getMemberSpy()
  • getJdaMock()
  • createTextChannelSpy
  • getPrivateChannelSpy() and mocking of private channel in general
  • map and flatMap support for succeeded and failed actions

@Zabuzard Zabuzard added enhancement New feature or request priority: normal labels Mar 15, 2022
@Zabuzard Zabuzard added this to the Improvement phase 1 milestone Mar 15, 2022
@Zabuzard Zabuzard self-assigned this Mar 15, 2022
@sonarcloud
Copy link

sonarcloud bot commented Mar 30, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@github-actions
Copy link

This pull request is stale because it has been open 30 days with no activity. Remove stale label, comment or add the valid label or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Apr 30, 2022
@Zabuzard Zabuzard added valid This issue/PR is validated and ready to be picked. This auto adds items to TJ project board. and removed stale labels Apr 30, 2022
@Zabuzard Zabuzard force-pushed the feature/unit_test_remind branch 2 times, most recently from 35dd55f to 07e8a0b Compare May 3, 2022 13:36
@Zabuzard Zabuzard marked this pull request as ready for review May 3, 2022 13:38
@Zabuzard Zabuzard requested review from a team as code owners May 3, 2022 13:38
* support for `OptionType.INTEGER` in slash command event builder
* `getMemberSpy()`
* `getJdaMock()`
* `createTextChannelSpy`
* `getPrivateChannelSpy()` and mocking of private channel in general
* `map` and `flatMap` support for `succeeded` and `failed` actions
@Zabuzard Zabuzard merged commit 0e1cfb5 into develop May 9, 2022
@Zabuzard Zabuzard deleted the feature/unit_test_remind branch May 9, 2022 11:20
@sonarcloud
Copy link

sonarcloud bot commented May 9, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: normal valid This issue/PR is validated and ready to be picked. This auto adds items to TJ project board.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit tests for /remind (and clock mocking)
1 participant