Skip to content

Commit 557a4c2

Browse files
committed
Updated unit tests
1 parent 83fc28d commit 557a4c2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Tests/CoreModelTests/CoreDataTests.swift

+7
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ final class CoreDataTests: XCTestCase {
8989
XCTAssertEqual(campgroundData.relationships[PropertyKey(Campground.CodingKeys.units)], .toMany([ObjectID(rentalUnit.id)]))
9090
let fetchedRentalUnit = try await store.fetch(Campground.RentalUnit.self, for: rentalUnit.id)
9191
XCTAssertEqual(fetchedRentalUnit, rentalUnit)
92+
93+
let rentalUnitFetchRequest = FetchRequest(
94+
entity: Campground.RentalUnit.entityName,
95+
predicate: Campground.RentalUnit.CodingKeys.campground.stringValue.compare(.equalTo, .relationship(.toOne(ObjectID(campground.id))))
96+
)
97+
let rentalUnitIDs = try await store.fetchID(rentalUnitFetchRequest)
98+
XCTAssertEqual(rentalUnitIDs, campground.units.map { ObjectID($0) })
9299
}
93100
}
94101

0 commit comments

Comments
 (0)