Files
InvestmentTrackerApp/PortfolioJournalTests/Views/MonthlyCheckInViewTests.swift
T
2026-02-11 23:37:11 +01:00

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")
}
}