Skip to content

Commit fbbce91

Browse files
committed
Updated unit tests
1 parent e46f139 commit fbbce91

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Tests/CoreModelMongoDBTests/MongoDBModelTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,11 @@ final class MongoDBModelTests: XCTestCase {
8282
XCTAssertEqual(campgroundData.relationships[PropertyKey(Campground.CodingKeys.units)], .toMany([ObjectID(rentalUnit.id)]))
8383
let fetchedRentalUnit = try await store.fetch(Campground.RentalUnit.self, for: rentalUnit.id)
8484
XCTAssertEqual(fetchedRentalUnit, rentalUnit)
85+
let rentalUnitFetchRequest = FetchRequest(
86+
entity: Campground.RentalUnit.entityName,
87+
predicate: Campground.RentalUnit.CodingKeys.campground.stringValue.compare(.equalTo, .relationship(.toOne(ObjectID(campground.id))))
88+
)
89+
let rentalUnitIDs = try await store.fetchID(rentalUnitFetchRequest)
90+
XCTAssertEqual(rentalUnitIDs, campground.units.map { ObjectID($0) })
8591
}
8692
}

0 commit comments

Comments
 (0)