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

Fix start and end date functionality and add tests #41

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

Conversation

AballahNsour
Copy link

@AballahNsour AballahNsour commented May 16, 2024

Name of the PR

♻️ Current situation & Problem

Link any open issues or pull requests (PRs) related to this PR. Please ensure that all non-trivial PRs are first tracked and discussed in an existing GitHub issue or discussion.

⚙️ Release Notes

Add a bullet point list summary of the feature and possible migration guides if this is a breaking change so this section can be added to the release notes.
Include code snippets that provide examples of the feature implemented or links to the documentation if it appends or changes the public interface.

📚 Documentation

Please ensure that you properly document any additions in conformance to Spezi Documentation Guide.
You can use this section to describe your solution, but we encourage contributors to document your reasoning and changes using in-line documentation.

✅ Testing

Please ensure that the PR meets the testing requirements set by CodeCov and that new functionality is appropriately tested.
This section describes important information about the tests and why some elements might not be testable.

📝 Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@PSchmiedmayer
Copy link
Member

@AballahNsour Thank you for taking a look at the issue! Feel free to create a PR and tag us if you have any questions. Always great to see contributions from outside contributors and we are happy to support you in the process!

@AballahNsour AballahNsour reopened this May 17, 2024
@AballahNsour
Copy link
Author

forgive me I went though the rules again it happens that i have vaiolated one of contribution rules i Will revert on the changes and I will start over.

@PSchmiedmayer
Copy link
Member

No worries; it is always a challenge to get started.

Let us know how we can be helpful, we always appreciate contributions and improvements 🚀

@AballahNsour
Copy link
Author

@PSchmiedmayer hello, I did the best i could with adding the two test cases.
I may need more assistance, but will learn fast :)

@PSchmiedmayer PSchmiedmayer added the test Test improvements label Jun 28, 2024
@PSchmiedmayer PSchmiedmayer self-requested a review June 28, 2024 17:12
Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AballahNsour thank you for working on the PR and adding some additional tests to this package; greatly appreciated!

This PR is a good step in the right direction; we are still missing some context from #21 that would allow us to close the issue.

  1. We successfully test that a task that has an end date works. I would suggest that we schedule a tasks that hast at least two scheduled times between the start and end date.
  2. We need to test the events(from,to) function in a separate unit test (to fully address Test Start and End Dates #21). This should include at task that has a fixed end date and one that might have a number of events and we should then retrieve taks up to the end date (and expect all the them to get back) and requests tasks up to an end data that should only return parts of the tasks.

A general suggestion for writing the tests: I would avoid using .now (or Date()) for dates. We had some issues with this here and in other packages. I would rather load dates based on fixed date and time combinations and use that for reasoning in the tests. Makes testing and communicating about the tests + asserting correct responses way easier.

Please also try to address all SwiftLint errors that might currently be raised as part of your changes. Thanks again for contributing to our open-source project!

XCTAssertEqual(scheduledEventHash, completedEventHash)
}
func testTaskSchedulingWithStartDateAndEndDate() async throws {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add empty lines between different functions:

Suggested change
func testTaskSchedulingWithStartDateAndEndDate() async throws {
func testTaskSchedulingWithStartDateAndEndDate() async throws {

XCTAssertEqual(scheduledEventHash, completedEventHash)
}
func testTaskSchedulingWithStartDateAndEndDate() async throws {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this test!

XCTAssertEqual(scheduledEventHash, completedEventHash)
}
func testTaskSchedulingWithStartDateAndEndDate() async throws {
let startDate = Date().addingTimeInterval(3_000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general suggestion for writing the tests: I would avoid using .now (or Date()) for dates. We had some issues with this here and in other packages. I would rather load dates based on fixed date and time combinations and use that for reasoning in the tests. Makes testing and communicating about the tests + asserting correct responses way easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Test improvements
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants