Phase 2: Constraint Validation - 2 plans in 1 wave (parallel) - Both plans autonomous (no checkpoints) Plan 02-01: Migrate 13 XCTest tests to Swift Testing Plan 02-02: Add edge case tests and document constraint API Note: ItineraryConstraints is already fully implemented. This phase verifies and standardizes tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
7.0 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, user_setup, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | user_setup | must_haves | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 02-constraint-validation | 01 | execute | 1 |
|
true |
|
Purpose: Standardize test patterns across the project. Phase 1 established Swift Testing as the project standard; constraint tests should follow.
Output: SportsTimeTests/Domain/ItineraryConstraintsTests.swift with all tests passing using @Test/@Suite syntax.
<execution_context>
@/.claude/get-shit-done/workflows/execute-plan.md
@/.claude/get-shit-done/templates/summary.md
</execution_context>
Pattern reference from Phase 1
@SportsTimeTests/Domain/SortOrderProviderTests.swift @SportsTimeTests/Domain/SemanticPositionPersistenceTests.swift
Source test file to migrate
@SportsTimeTests/ItineraryConstraintsTests.swift
Implementation being tested
@SportsTime/Core/Models/Domain/ItineraryConstraints.swift
Task 1: Verify requirements coverage in existing tests SportsTimeTests/ItineraryConstraintsTests.swift Read the existing 13 XCTest tests and map them to requirements:| Requirement | Test(s) | Coverage |
|---|---|---|
| CONS-01 (games cannot move) | test_gameItem_cannotBeMoved | Verify complete |
| CONS-02 (travel day range) | test_travel_validDayRange_simpleCase, test_travel_cannotGoOutsideValidDayRange | Verify complete |
| CONS-03 (travel sortOrder on game days) | test_travel_mustBeAfterDepartureGames, test_travel_mustBeBeforeArrivalGames, test_travel_mustBeAfterAllDepartureGamesOnSameDay, test_travel_mustBeBeforeAllArrivalGamesOnSameDay, test_travel_canBeAnywhereOnRestDays | Verify complete |
| CONS-04 (custom no constraints) | test_customItem_canGoOnAnyDay, test_customItem_canGoBeforeOrAfterGames | Verify complete |
Document any gaps found. If all requirements are covered, proceed to migration. Requirements coverage table is complete with no gaps All CONS-01 through CONS-04 requirements map to at least one existing test
Task 2: Migrate tests to Swift Testing SportsTimeTests/Domain/ItineraryConstraintsTests.swift, SportsTimeTests/ItineraryConstraintsTests.swift 1. Create new file at `SportsTimeTests/Domain/ItineraryConstraintsTests.swift`-
Convert XCTest syntax to Swift Testing:
final class ItineraryConstraintsTests: XCTestCase->@Suite("ItineraryConstraints") struct ItineraryConstraintsTestsfunc test_*()->@Test("description") func *()(preserve test names, add descriptive strings)XCTAssertTrue(x)->#expect(x == true)or#expect(x)XCTAssertFalse(x)->#expect(x == false)or#expect(!x)XCTAssertEqual(a, b)->#expect(a == b)XCTAssertNil(x)->#expect(x == nil)import XCTest->import Testing
-
Organize tests into logical groups using MARK comments:
// MARK: - Custom Item Tests (CONS-04)// MARK: - Travel Day Range Tests (CONS-02)// MARK: - Travel SortOrder Tests (CONS-03)// MARK: - Game Immutability Tests (CONS-01)// MARK: - Edge Cases// MARK: - Barrier Games// MARK: - Helpers
-
Preserve all helper methods (makeConstraints, makeGameItem, makeTravelItem, makeCustomItem)
-
Delete the old file at
SportsTimeTests/ItineraryConstraintsTests.swift
Pattern reference - follow SortOrderProviderTests.swift style:
import Testing
import Foundation
@testable import SportsTime
@Suite("ItineraryConstraints")
struct ItineraryConstraintsTests {
// MARK: - Custom Item Tests (CONS-04)
@Test("custom: can go on any day")
func custom_canGoOnAnyDay() {
let constraints = makeConstraints(tripDays: 5, gameDays: [1, 5])
let customItem = makeCustomItem(day: 1, sortOrder: 50)
for day in 1...5 {
#expect(constraints.isValidPosition(for: customItem, day: day, sortOrder: 50))
}
}
// ...
}
- Commit the migration:
git add SportsTimeTests/Domain/ItineraryConstraintsTests.swift
git rm SportsTimeTests/ItineraryConstraintsTests.swift
git commit -m "test(02-01): migrate ItineraryConstraints tests to Swift Testing
Migrate 13 XCTest tests to Swift Testing framework:
- Move to Domain/ folder to match project structure
- Convert XCTestCase to @Suite/@Test syntax
- Update assertions to #expect macros
- Verify all CONS-01 through CONS-04 requirements covered
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
<success_criteria>
- 13 tests migrated from XCTest to Swift Testing
- Tests use @Test/@Suite syntax matching Phase 1 patterns
- All CONS-01 through CONS-04 requirements have corresponding tests
- Full test suite passes </success_criteria>