File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,12 +82,14 @@ final class CoreDataTests: XCTestCase {
8282 var campgroundData = try campground. encode ( log: { print ( " Encoder: " , $0) } )
8383 try await store. insert ( campgroundData)
8484 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)
8687 campgroundData = try await store. fetch ( Campground . entityName, for: ObjectID ( campground. id) ) !
8788 campground = try . init( from: campgroundData, log: { print ( " Decoder: " , $0) } )
8889 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)
9193 }
9294}
9395
You can’t perform that action at this time.
0 commit comments