File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -82,12 +82,14 @@ final class CoreDataTests: XCTestCase {
82
82
var campgroundData = try campground. encode ( log: { print ( " Encoder: " , $0) } )
83
83
try await store. insert ( campgroundData)
84
84
let rentalUnitData = try rentalUnit. encode ( log: { print ( " Encoder: " , $0) } )
85
- try await store. insert ( rentalUnit)
85
+ XCTAssertEqual ( rentalUnitData. relationships [ PropertyKey ( Campground . RentalUnit. CodingKeys. campground) ] , . toOne( ObjectID ( campground. id) ) )
86
+ try await store. insert ( rentalUnitData)
86
87
campgroundData = try await store. fetch ( Campground . entityName, for: ObjectID ( campground. id) ) !
87
88
campground = try . init( from: campgroundData, log: { print ( " Decoder: " , $0) } )
88
89
XCTAssertEqual ( campground. units, [ rentalUnit. id] )
89
- //let fetchedRentalUnit = try await store.fetch(Campground.RentalUnit.self, for: rentalUnit.id)
90
- //XCTAssertEqual(fetchedRentalUnit, rentalUnit)
90
+ XCTAssertEqual ( campgroundData. relationships [ PropertyKey ( Campground . CodingKeys. units) ] , . toMany( [ ObjectID ( rentalUnit. id) ] ) )
91
+ let fetchedRentalUnit = try await store. fetch ( Campground . RentalUnit. self, for: rentalUnit. id)
92
+ XCTAssertEqual ( fetchedRentalUnit, rentalUnit)
91
93
}
92
94
}
93
95
You can’t perform that action at this time.
0 commit comments