4761e2e5c8
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1.0 KiB
Swift
37 lines
1.0 KiB
Swift
import XCTest
|
|
@testable import PortfolioJournal
|
|
|
|
final class MonthlyCheckInViewTests: XCTestCase {
|
|
func testMonthLabelUsesMonthAndYear() {
|
|
var components = DateComponents()
|
|
components.year = 2026
|
|
components.month = 2
|
|
components.day = 1
|
|
let date = Calendar(identifier: .gregorian).date(from: components)!
|
|
|
|
let label = MonthlyCheckInView.monthLabel(
|
|
for: date,
|
|
relativeTo: date,
|
|
locale: Locale(identifier: "en_US_POSIX")
|
|
)
|
|
|
|
XCTAssertEqual(label, "February 2026")
|
|
}
|
|
|
|
func testMonthLabelUsesPreviousMonthDuringGracePeriod() {
|
|
var components = DateComponents()
|
|
components.year = 2026
|
|
components.month = 2
|
|
components.day = 20
|
|
let date = Calendar(identifier: .gregorian).date(from: components)!
|
|
|
|
let label = MonthlyCheckInView.monthLabel(
|
|
for: date,
|
|
relativeTo: date,
|
|
locale: Locale(identifier: "en_US_POSIX")
|
|
)
|
|
|
|
XCTAssertEqual(label, "January 2026")
|
|
}
|
|
}
|