Skip to content

Commit

Permalink
Updated unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Aug 21, 2023
1 parent 83fc28d commit 557a4c2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Tests/CoreModelTests/CoreDataTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ final class CoreDataTests: XCTestCase {
XCTAssertEqual(campgroundData.relationships[PropertyKey(Campground.CodingKeys.units)], .toMany([ObjectID(rentalUnit.id)]))
let fetchedRentalUnit = try await store.fetch(Campground.RentalUnit.self, for: rentalUnit.id)
XCTAssertEqual(fetchedRentalUnit, rentalUnit)

let rentalUnitFetchRequest = FetchRequest(
entity: Campground.RentalUnit.entityName,
predicate: Campground.RentalUnit.CodingKeys.campground.stringValue.compare(.equalTo, .relationship(.toOne(ObjectID(campground.id))))
)
let rentalUnitIDs = try await store.fetchID(rentalUnitFetchRequest)
XCTAssertEqual(rentalUnitIDs, campground.units.map { ObjectID($0) })
}
}

Expand Down

0 comments on commit 557a4c2

Please sign in to comment.