@@ -24,52 +24,52 @@ final class CoreDataIterativeMigrator_MigrationStepTests: XCTestCase {
2424
2525 func test_steps_returns_MigrationSteps_from_source_to_the_target_model( ) throws {
2626 // Given
27- let modelVersion63 = ModelVersion ( name: " Model 63 " )
28- let modelVersion71 = ModelVersion ( name: " Model 71 " )
29- let sourceModel = try XCTUnwrap ( modelsInventory. model ( for: modelVersion63 ) )
30- let targetModel = try XCTUnwrap ( modelsInventory. model ( for: modelVersion71 ) )
27+ let modelVersion83 = ModelVersion ( name: " Model 83 " )
28+ let modelVersion91 = ModelVersion ( name: " Model 91 " )
29+ let sourceModel = try XCTUnwrap ( modelsInventory. model ( for: modelVersion83 ) )
30+ let targetModel = try XCTUnwrap ( modelsInventory. model ( for: modelVersion91 ) )
3131
3232 // When
3333 let steps = try MigrationStep . steps ( using: modelsInventory, source: sourceModel, target: targetModel)
3434
3535 // Then
3636 // There should be 8 steps:
37- // - 63 to 64
38- // - 64 to 65
39- // - 65 to 66
40- // - 66 to 67
41- // - 67 to 68
42- // - 68 to 69
43- // - 69 to 70
44- // - 70 to 71
37+ // - 83 to 84
38+ // - 84 to 85
39+ // - 85 to 86
40+ // - 86 to 87
41+ // - 87 to 88
42+ // - 88 to 89
43+ // - 89 to 90
44+ // - 90 to 91
4545 XCTAssertEqual ( steps. count, 8 )
4646
4747 // Assert the values of first and last steps.
48- let modelVersion64 = ModelVersion ( name: " Model 64 " )
48+ let modelVersion84 = ModelVersion ( name: " Model 84 " )
4949
50- let expectedFirstStep = MigrationStep ( sourceVersion: modelVersion63 ,
51- sourceModel: try XCTUnwrap ( modelsInventory. model ( for: modelVersion63 ) ) ,
52- targetVersion: modelVersion64 ,
53- targetModel: try XCTUnwrap ( modelsInventory. model ( for: modelVersion64 ) ) )
50+ let expectedFirstStep = MigrationStep ( sourceVersion: modelVersion83 ,
51+ sourceModel: try XCTUnwrap ( modelsInventory. model ( for: modelVersion83 ) ) ,
52+ targetVersion: modelVersion84 ,
53+ targetModel: try XCTUnwrap ( modelsInventory. model ( for: modelVersion84 ) ) )
5454 let actualFirstStep = try XCTUnwrap ( steps. first)
5555 XCTAssertEqual ( actualFirstStep, expectedFirstStep)
5656
57- let modelVersion70 = ModelVersion ( name: " Model 70 " )
57+ let modelVersion90 = ModelVersion ( name: " Model 90 " )
5858
59- let expectedLastStep = MigrationStep ( sourceVersion: modelVersion70 ,
60- sourceModel: try XCTUnwrap ( modelsInventory. model ( for: modelVersion70 ) ) ,
61- targetVersion: modelVersion71 ,
62- targetModel: try XCTUnwrap ( modelsInventory. model ( for: modelVersion71 ) ) )
59+ let expectedLastStep = MigrationStep ( sourceVersion: modelVersion90 ,
60+ sourceModel: try XCTUnwrap ( modelsInventory. model ( for: modelVersion90 ) ) ,
61+ targetVersion: modelVersion91 ,
62+ targetModel: try XCTUnwrap ( modelsInventory. model ( for: modelVersion91 ) ) )
6363 let actualLastStep = try XCTUnwrap ( steps. last)
6464 XCTAssertEqual ( actualLastStep, expectedLastStep)
6565 }
6666
6767 func test_steps_returns_one_MigrationStep_if_the_source_and_target_are_next_to_each_other( ) throws {
6868 // Given
69- let sourceVersion = ModelVersion ( name: " Model 67 " )
69+ let sourceVersion = ModelVersion ( name: " Model 87 " )
7070 let sourceModel = try XCTUnwrap ( modelsInventory. model ( for: sourceVersion) )
7171
72- let targetVersion = ModelVersion ( name: " Model 68 " )
72+ let targetVersion = ModelVersion ( name: " Model 88 " )
7373 let targetModel = try XCTUnwrap ( modelsInventory. model ( for: targetVersion) )
7474
7575 // When
@@ -140,23 +140,23 @@ final class CoreDataIterativeMigrator_MigrationStepTests: XCTestCase {
140140 /// reach this condition because of the precondition checks in `CoreDataIterativeMigrator`.
141141 func test_steps_returns_source_to_latest_version_MigrationSteps_if_the_source_and_target_are_the_same( ) throws {
142142 // Given
143- let sourceModelName = " Model 67 "
143+ let sourceModelName = " Model 87 "
144144 let modelVersion37 = ModelVersion ( name: sourceModelName)
145145 let sourceModel = try XCTUnwrap ( modelsInventory. model ( for: modelVersion37) )
146146
147- // Find the index of Model 67 in the current inventory
148- // which only contains Models 60-124 as per latest update on https://github.com/woocommerce/woocommerce-ios/pull/15987
147+ // Find the index of Model 87 in the current inventory
148+ // which only contains Models 80-127 as per latest update on [TBD]
149149 let sourceModelIndex = try XCTUnwrap ( modelsInventory. versions. firstIndex { $0. name == sourceModelName } ,
150- " Model 67 should exist in the inventory " )
150+ " Model 87 should exist in the inventory " )
151151 // When
152152 let steps = try MigrationStep . steps ( using: modelsInventory, source: sourceModel, target: sourceModel)
153153
154154 // Then
155155 // Expected behavior (bug): When source == target, it returns steps from that model to the latest version
156- // This means: Model 67 → Model 68 → ... → Model 124
156+ // This means: Model 87 → Model 88 → ... → Model 127
157157 // Calculation: total versions - source index - 1 (since we don't include the source model itself)
158158 let expectedStepCount = modelsInventory. versions. count - sourceModelIndex - 1
159159 XCTAssertEqual ( steps. count, expectedStepCount,
160- " Should return steps from Model 67 to the latest model (Model 124 ) " )
160+ " Should return steps from Model 87 to the latest model (Model 127 ) " )
161161 }
162162}
0 commit comments