Files
SportstimeAPI/.planning/phases/02-constraint-validation/02-01-PLAN.md
Trey t 51b6d46d84 docs(02): create phase 2 constraint validation plans
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>
2026-01-18 14:48:10 -06:00

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
SportsTimeTests/ItineraryConstraintsTests.swift
true
truths artifacts key_links
All CONS-01 through CONS-04 requirements have corresponding passing tests
Tests use Swift Testing framework (@Test, @Suite) matching Phase 1 patterns
ItineraryConstraints API is fully tested with no coverage gaps
path provides contains min_lines
SportsTimeTests/Domain/ItineraryConstraintsTests.swift Migrated constraint validation tests @Suite 200
from to via pattern
SportsTimeTests/Domain/ItineraryConstraintsTests.swift SportsTime/Core/Models/Domain/ItineraryConstraints.swift import @testable SportsTime @testable import SportsTime
Migrate the 13 existing XCTest constraint tests to Swift Testing and move them to the Domain test folder.

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>

@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/02-constraint-validation/02-RESEARCH.md

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`
  1. Convert XCTest syntax to Swift Testing:

    • final class ItineraryConstraintsTests: XCTestCase -> @Suite("ItineraryConstraints") struct ItineraryConstraintsTests
    • func 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
  2. 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
  3. Preserve all helper methods (makeConstraints, makeGameItem, makeTravelItem, makeCustomItem)

  4. 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))
        }
    }
    // ...
}
Run tests: ``` xcodebuild -project SportsTime.xcodeproj -scheme SportsTime -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' -only-testing:SportsTimeTests/ItineraryConstraintsTests test 2>&1 | grep -E "(Test Suite|Executed|passed|failed)" ``` All 13 tests pass. New file at Domain/ItineraryConstraintsTests.swift passes all 13 tests, old file deleted Task 3: Run full test suite and commit None (verification only) 1. Run full test suite to verify no regressions: ``` xcodebuild -project SportsTime.xcodeproj -scheme SportsTime -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' test 2>&1 | grep -E "(Test Suite|Executed|passed|failed)" ```
  1. 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>"
Full test suite passes with no regressions Migration committed, all tests pass including existing 34 Phase 1 tests After all tasks: 1. `SportsTimeTests/Domain/ItineraryConstraintsTests.swift` exists with @Suite/@Test syntax 2. Old `SportsTimeTests/ItineraryConstraintsTests.swift` is deleted 3. All 13 constraint tests pass 4. Full test suite passes (no regressions) 5. Tests organized by requirement (CONS-01 through CONS-04)

<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>
After completion, create `.planning/phases/02-constraint-validation/02-01-SUMMARY.md`