Skip to content

Commit 8f2cb7e

Browse files
committed
Updated unit tests
1 parent 9a22ec1 commit 8f2cb7e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Tests/CoreModelTests/CoreDataTests.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)