Fix test infrastructure for Rooms feature and improve testability

- Update Plant test fixtures to use roomID instead of deprecated location
- Add URLDataFetcher protocol to ImageCache for dependency injection
- Update ImageCacheTests to use protocol-based mock instead of URLSession subclass
- Add missing cancelReminders(for:plantID:) method to MockNotificationService
- Add Equatable conformance to ImageCacheError for test assertions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-01-23 14:55:50 -06:00
parent 7786a40ae0
commit 08ced7dbbb
5 changed files with 89 additions and 43 deletions

View File

@@ -31,7 +31,7 @@ extension Plant {
/// - notes: User notes. Defaults to nil.
/// - isFavorite: Favorite status. Defaults to false.
/// - customName: User-assigned name. Defaults to nil.
/// - location: Plant location. Defaults to nil.
/// - roomID: Room ID where plant is located. Defaults to nil.
/// - Returns: A configured Plant instance for testing
static func mock(
id: UUID = UUID(),
@@ -48,7 +48,7 @@ extension Plant {
notes: String? = nil,
isFavorite: Bool = false,
customName: String? = nil,
location: String? = nil
roomID: UUID? = nil
) -> Plant {
Plant(
id: id,
@@ -65,7 +65,7 @@ extension Plant {
notes: notes,
isFavorite: isFavorite,
customName: customName,
location: location
roomID: roomID
)
}
@@ -206,7 +206,7 @@ extension Plant {
notes: "Needs regular watering and indirect light",
isFavorite: true,
customName: "My Beautiful Monstera",
location: "Living room by the window"
roomID: nil
)
}
}