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

BAH 3049 | Samridhi | Fix start date undefined value #716

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Samridhi-98
Copy link
Contributor

No description provided.

@Samridhi-98 Samridhi-98 marked this pull request as ready for review October 11, 2023 17:15
@@ -44,5 +44,6 @@
"CHOOSE_ANSWER_FROM_DROPDOWN_LABEL": "Choose Answer",
"DELETE_LABEL": "Delete",
"EDIT_LABEL": "Edit",
"REPORT_DATE_RANGE": "Select Date Range"
"REPORT_DATE_RANGE": "Select Date Range",
"START_DATE_CANNOT_GREATER_THAN_STOP_DATE": "start date can not be greater than stop date"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you rephrase this to "Later" instead of "Greater"?

Start date cannot be later than the End Date.

expect(rootScope.reportsRequiringDateRange[0].startDate.getDate()).toBe(rootScope.default.reportsRequiringDateRange.startDate.getDate());
expect(rootScope.reportsRequiringDateRange[0].startDate.getMonth()).toBe(currentDate.getMonth());
expect(rootScope.reportsRequiringDateRange[0].stopDate.getDate()).toBe(currentDate.getDate());
expect(rootScope.reportsRequiringDateRange[0].stopDate.getMonth()).toBe(currentDate.getMonth());
Copy link
Contributor

Choose a reason for hiding this comment

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

If the currentDate is 2-Oct-2023 (Mon), then for Menu option Last 7 days, the dates selected automatically should be: 26-Sep-2023 (Tue) to 2-Oct-2023 (Mon). In this case the startDate month = Sep (and not Oct). But I think your test is checking startDate.getMonth() to be currentDate.getMonth(). That isn't right I think. This test will break on certain days I think. Please reconfirm.

It would have been best if somehow tests could be written independent of actual date (today), and instead could be passed something like: If Current Date is X, then option Last 7 Days should show DateA and DateB, and so on. I am guessing that will require a little refactoring if your code, to take currentDate as a parameter, and then do calculations.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you can otherwise try and use Jasmine clock to mock the current Date. See this ChatGPT discussion I just did regarding this code block (scroll to end for Jasmine clock): https://chat.openai.com/share/42d88843-c43c-4dfc-81bc-6ef80438efbf

Copy link
Contributor

@gsluthra gsluthra left a comment

Choose a reason for hiding this comment

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

Please see my comment on Test cases.

@Samridhi-98
Copy link
Contributor Author

Please see my comment on Test cases.

sure, I'll check.

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.

2 participants