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

test(server) adds a test case to taskManager #15182

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

drob
Copy link

@drob drob commented Mar 31, 2024

The new test covers the case in which getTasks is invoked with a dueDate parameter. None of the existing test cases covers this case.

The new test case aims to verify the behavior of getTasks when a dueDate is provided, ensuring that the nextDue property is properly set for daily tasks based on the given dueDate.

This adds new test coverage:

  • 3 lines in server/libs/tasks/utils.js, in setNextDue
  • 20 lines in server/libs/tasks/index.js, mostly in getTasks

The new test covers the case in which `getTasks` is invoked with a `dueDate` parameter. None of the existing test cases covers this case.

The new test case aims to verify the behavior of `getTasks` when a `dueDate` is provided, ensuring that the `nextDue` property is properly set for daily tasks based on the given dueDate.

The new test adds new coverage:
- 3 lines in server/libs/tasks/utils.js, in `setNextDue`
- 20 lines in server/libs/tasks/index.js, mostly in `getTasks`
@drob drob changed the title Adds a test case to taskManager. test(server) adds a test case to taskManager Mar 31, 2024
@negue
Copy link
Member

negue commented Jun 14, 2024

Hey!

there are currently 7 (that I count of) tests using the dueDate Query Param, see: https://github.com/HabitRPG/habitica/blob/develop/test/api/v3/integration/tasks/GET-tasks_user.test.js#L132 Added around 2017-2019

Shouldn't those tests also cover those lines you mentioned? or did I miss something? if so please tell me^^

@drob
Copy link
Author

drob commented Jun 14, 2024

Hello! I believe those are all integration tests. There aren't any tests in the unit test suite that use dueDate. (Or, in particular, access those lines of code in server/libs/tasks/)

@negue
Copy link
Member

negue commented Jun 15, 2024

Ah fair point, if there are more uses of that internally it might be nice to have those tests as well :)

@SabreCat LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants