import XCTest @testable import TabataGo final class TabataGoTests: XCTestCase { func testStreakComputationConsecutiveDays() { // Consecutive 3 days should yield streak of 3 let calendar = Calendar.current let today = calendar.startOfDay(for: Date()) let sessions: [Date] = [ today, calendar.date(byAdding: .day, value: -1, to: today)!, calendar.date(byAdding: .day, value: -2, to: today)!, ] // Validate unique day count XCTAssertEqual(sessions.count, 3) } func testWorkoutSessionCompletionRate() { let session = WorkoutSession( programId: "test", programTitle: "Test", bodyZone: "full", level: "Beginner", startedAt: Date(), completedAt: Date(), durationSeconds: 1440, caloriesBurned: 180, roundsCompleted: 8, totalRounds: 8 ) XCTAssertEqual(session.completionRate, 1.0) } func testWorkoutSessionPartialCompletionRate() { let session = WorkoutSession( programId: "test", programTitle: "Test", bodyZone: "full", level: "Beginner", startedAt: Date(), completedAt: Date(), durationSeconds: 720, caloriesBurned: 90, roundsCompleted: 4, totalRounds: 8 ) XCTAssertEqual(session.completionRate, 0.5) } func testSubscriptionPlanIsPremium() { XCTAssertFalse(SubscriptionPlan.free.isPremium) XCTAssertTrue(SubscriptionPlan.premiumMonthly.isPremium) XCTAssertTrue(SubscriptionPlan.premiumYearly.isPremium) } func testTimerPhaseColors() { // Phase colors should differ XCTAssertNotEqual(Theme.phaseColor(.work), Theme.phaseColor(.rest)) XCTAssertNotEqual(Theme.phaseColor(.work), Theme.phaseColor(.complete)) } }