Skip to content

Commit 12e579c

Browse files
committed
Update unit tests
1 parent 1a2ee4e commit 12e579c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Tests/CoreModelTests/CoreDataTests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import Testing
1717
struct CoreDataTests {
1818

1919
@available(macOS 12, iOS 15, watchOS 8, tvOS 15, *)
20-
@Test func coreData() async throws {
20+
@Test
21+
func coreData() async throws {
2122

2223
let model = Model(
2324
entities:
@@ -88,14 +89,14 @@ struct CoreDataTests {
8889
campground = try .init(from: campgroundData, log: { print("Decoder:", $0) })
8990
#expect(campground.units == [rentalUnit.id])
9091
#expect(campgroundData.relationships[PropertyKey(Campground.CodingKeys.units)] == .toMany([ObjectID(rentalUnit.id)]))
91-
let fetchedRentalUnit = try await store.fetch(Campground.Unit.self, for: rentalUnit.id)
92+
let fetchedRentalUnit = try await store.viewContext.fetch(Campground.Unit.self, for: rentalUnit.id)
9293
#expect(fetchedRentalUnit == rentalUnit)
9394

9495
let rentalUnitFetchRequest = FetchRequest(
9596
entity: Campground.Unit.entityName,
9697
predicate: Campground.Unit.CodingKeys.campground.stringValue.compare(.equalTo, .relationship(.toOne(ObjectID(campground.id))))
9798
)
98-
let rentalUnitIDs = try await store.fetchID(rentalUnitFetchRequest)
99+
let rentalUnitIDs = try store.viewContext.fetchID(rentalUnitFetchRequest)
99100
#expect(rentalUnitIDs == campground.units.map { ObjectID($0) })
100101
}
101102
}

0 commit comments

Comments
 (0)