Files
PlantGuide/PlantGuideTests/Data/Repositories/InMemoryPlantRepositoryTests.swift
Trey t 136dfbae33 Add PlantGuide iOS app with plant identification and care management
- Implement camera capture and plant identification workflow
- Add Core Data persistence for plants, care schedules, and cached API data
- Create collection view with grid/list layouts and filtering
- Build plant detail views with care information display
- Integrate Trefle botanical API for plant care data
- Add local image storage for captured plant photos
- Implement dependency injection container for testability
- Include accessibility support throughout the app

Bug fixes in this commit:
- Fix Trefle API decoding by removing duplicate CodingKeys
- Fix LocalCachedImage to load from correct PlantImages directory
- Set dateAdded when saving plants for proper collection sorting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 12:18:01 -06:00

44 lines
1.3 KiB
Swift

//
// InMemoryPlantRepositoryTests.swift
// PlantGuideTests
//
// Tests for InMemoryPlantRepository protocol conformance.
//
import XCTest
@testable import PlantGuide
final class InMemoryPlantRepositoryTests: XCTestCase {
// MARK: - Protocol Conformance Tests
func testConformsToPlantRepositoryProtocol() async {
// This test verifies at compile time that InMemoryPlantRepository
// conforms to PlantRepositoryProtocol
let repo: PlantRepositoryProtocol = InMemoryPlantRepository.shared
XCTAssertNotNil(repo)
}
func testConformsToPlantCollectionRepositoryProtocol() async {
let repo: PlantCollectionRepositoryProtocol = InMemoryPlantRepository.shared
XCTAssertNotNil(repo)
}
func testConformsToFavoritePlantRepositoryProtocol() async {
let repo: FavoritePlantRepositoryProtocol = InMemoryPlantRepository.shared
XCTAssertNotNil(repo)
}
// MARK: - Basic Operations Tests
func testFetchAllReturnsPlants() async throws {
let repo = InMemoryPlantRepository.shared
let plants = try await repo.fetchAll()
// In DEBUG mode, should have sample data seeded
#if DEBUG
XCTAssertFalse(plants.isEmpty, "Repository should have sample data in DEBUG mode")
#endif
}
}