-
Notifications
You must be signed in to change notification settings - Fork 292
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
base: master
Are you sure you want to change the base?
Conversation
ui/app/i18n/reports/locale_en.json
Outdated
@@ -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" |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this 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.
sure, I'll check. |
No description provided.