-
Notifications
You must be signed in to change notification settings - Fork 901
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(iOS): DAUTests.testMondayOfCurrentWeekFormatted() unit test #27128
Conversation
let gregorianCalendarYear = gregorianCalendar.dateComponents([.year], from: Date()).year | ||
XCTAssertEqual(gregorianCalendarYear, year) |
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.
Wouldn't this fail if the monday of the current week is in a previous year? For example from 2024-2025, if the current date was Jan 1 2025 (Wed), the monday of the week would be Dec 30 2024
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.
Hmm yeah I think you're right since we're looking backwards. Maybe better to check against gregorianCalendarYear - 1
for that case, ex:
XCTAssert(year >= (gregorianCalendarYear - 1) && year <= gregorianCalendarYear)
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.
Either that or use a fixed date for generating the current monday (which honestly may be safer anyways)
Released in v1.75.150 |
DateComponents
so the year shouldn't need updated.Resolves brave/brave-browser#43117
Resolves brave/brave-browser#43132
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Run
DAUTests.testMondayOfCurrentWeekFormatted()