Skip to content

Fixed date issue with calendar test #174

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

Merged
merged 2 commits into from
Apr 6, 2025

Conversation

tuj
Copy link
Contributor

@tuj tuj commented Apr 4, 2025

Link to ticket

https://leantime.itkdev.dk/#/tickets/showTicket/4084

Description

Fixed date issue with calendar test

Checklist

  • My code is covered by test cases.
  • My code passes our test (all our tests).
  • My code passes our static analysis suite.
  • My code passes our continuous integration process.

@tuj tuj added the bug Something isn't working label Apr 4, 2025
@tuj tuj requested a review from turegjorup April 4, 2025 10:41
@tuj tuj self-assigned this Apr 4, 2025
Copy link
Contributor

@turegjorup turegjorup left a comment

Choose a reason for hiding this comment

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

Please fix naming and duplication. Also adding a comment on what needs to be considered in regards to time mocking and asserts would great for future reference.

cy.clock();
cy.tick(timestamp);

const now = new Date(timestamp);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use a more descriptive name than now, either mockNow, mockTestDate or something even better.

});

it("Calendar multiple days", () => {
const timestamp = 60 * 60 * 1000 * 8;
Copy link
Contributor

Choose a reason for hiding this comment

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

Add comment explaining the choice of math :-)

Consider changing timestamp to a more descriptive name

});

it("Calendar multiple", () => {
const timestamp = 60 * 60 * 1000 * 8;
Copy link
Contributor

Choose a reason for hiding this comment

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

As above

Copy link
Contributor

Choose a reason for hiding this comment

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

Also. Is it necessary to duplicate code?

@@ -682,6 +745,13 @@ describe("Calendar", () => {
});

it("Calendar single", () => {
const timestamp = 60 * 60 * 1000 * 8;
Copy link
Contributor

Choose a reason for hiding this comment

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

As above

@tuj tuj requested a review from turegjorup April 4, 2025 11:07
@turegjorup turegjorup merged commit d488d8c into develop Apr 6, 2025
4 checks passed
@turegjorup turegjorup deleted the feature/fix-calendar-fixtures branch April 6, 2025 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants