Skip to content

Commit

Permalink
fix(iOS): DAUTests.testMondayOfCurrentWeekFormatted() unit test (#27128)
Browse files Browse the repository at this point in the history
* Update DAUTests.testMondayOfCurrentWeekFormatted().
  • Loading branch information
StephenHeaps authored Jan 6, 2025
1 parent 13f5bf8 commit b375744
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ios/brave-ios/Tests/GrowthTests/DAUTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,14 @@ class DAUTests: XCTestCase {
}

func testMondayOfCurrentWeekFormatted() {
// Jan 6th, 2025
let dateForTest = Date(timeIntervalSince1970: 1_736_139_600)

// Making sure gregorian year is showing
let yearString = Date().mondayOfCurrentWeekFormatted?.truncate(length: 4, trailing: "")
let year = Int(yearString!)!

// There is no easy way to mock a different calendar in unit tests, just checking if
// year we get looks 'correct' should be good enough.
XCTAssert(year > 2018 && year < 2025)
XCTAssertEqual(year, 2025)
}

func testNonDefaultWoiExplicitDate() {
Expand Down

0 comments on commit b375744

Please sign in to comment.