Skip to content

Commit 3ff73ba

Browse files
committed
Add BlogAuthor create and read in 154-155 migration test - Crash!
1 parent 9948ade commit 3ff73ba

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Tests/WordPressDataTests/MigrationTests.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ struct MigrationTests {
1616
let context154 = contextManager154.newDerivedContext()
1717
let blog = BlogBuilder(context154)
1818
.build()
19+
20+
// BlogAuthor is one of the Swift-first models that needed module reference updates in
21+
// https://github.com/wordpress-mobile/WordPress-iOS/pull/24494
22+
let author = NSEntityDescription.insertNewObject(
23+
forEntityName: BlogAuthor.entityName(),
24+
into: context154
25+
) as! BlogAuthor
26+
1927
contextManager154.saveContextAndWait(context154)
2028

2129
// Create a context manager for the 155 model, it will run the migration automatically
@@ -31,5 +39,11 @@ struct MigrationTests {
3139
let results = try context155.fetch(request)
3240
#expect(results.count == 1)
3341
#expect((results.first as? Blog)?.url == blog.url)
42+
43+
let authorRequest = BlogAuthor.fetchRequest()
44+
authorRequest.predicate = NSPredicate(format: "userId == %@", author.userID)
45+
let authorResults = try context155.fetch(authorRequest)
46+
#expect(authorResults.count == 1)
47+
#expect((authorResults.first as? Blog)?.url == blog.url)
3448
}
3549
}

0 commit comments

Comments
 (0)