feat: add planning tips and grouped trip options sorting
- Add PlanningTips data model with 105 tips across 7 categories - Wire random tips into HomeView (3 tips per session) - Add TripOptionsGrouper for grouping by city/game count and mileage - Update TripOptionsView with sectioned display when sorting - Recommended and Best Efficiency remain flat lists Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
38
SportsTimeTests/PlanningTipsTests.swift
Normal file
38
SportsTimeTests/PlanningTipsTests.swift
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// PlanningTipsTests.swift
|
||||
// SportsTimeTests
|
||||
//
|
||||
|
||||
import Testing
|
||||
@testable import SportsTime
|
||||
|
||||
struct PlanningTipsTests {
|
||||
|
||||
@Test func allTipsHasAtLeast100Tips() {
|
||||
#expect(PlanningTips.all.count >= 100)
|
||||
}
|
||||
|
||||
@Test func randomReturnsRequestedCount() {
|
||||
let tips = PlanningTips.random(3)
|
||||
#expect(tips.count == 3)
|
||||
}
|
||||
|
||||
@Test func randomReturnsUniqueIds() {
|
||||
let tips = PlanningTips.random(5)
|
||||
let uniqueIds = Set(tips.map { $0.id })
|
||||
#expect(uniqueIds.count == 5)
|
||||
}
|
||||
|
||||
@Test func eachTipHasNonEmptyFields() {
|
||||
for tip in PlanningTips.all {
|
||||
#expect(!tip.icon.isEmpty, "Tip should have icon")
|
||||
#expect(!tip.title.isEmpty, "Tip should have title")
|
||||
#expect(!tip.subtitle.isEmpty, "Tip should have subtitle")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func randomWithCountGreaterThanAvailableReturnsAll() {
|
||||
let tips = PlanningTips.random(1000)
|
||||
#expect(tips.count == PlanningTips.all.count)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user