Files
tabatago/tabatago-swift/TabataGoTests/TabataGoTests.swift
Millian Lamiaux 89cca25e22 remove Expo project and all related files
Remove the entire Expo/React Native application: routes (app/), source
code (src/), assets, iOS native build, config plugins, StoreKit config,
npm dependencies, TypeScript/ESLint/Vitest configs, and Expo-specific
documentation. The repository now contains only: admin-web, supabase,
youtube-worker, tabatago-swift, docs, scripts, and CI/tooling configs.
2026-04-21 21:55:00 +02:00

63 lines
1.9 KiB
Swift

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