// // DataProviderTests.swift // SportsTimeTests // // TDD specification tests for DataProvider types. // import Testing import Foundation @testable import SportsTime // MARK: - DataProviderError Tests @Suite("DataProviderError") struct DataProviderErrorTests { // MARK: - Specification Tests: errorDescription /// - Expected Behavior: contextNotConfigured has meaningful error message @Test("errorDescription: contextNotConfigured mentions configuration") func errorDescription_contextNotConfigured() { let error = DataProviderError.contextNotConfigured #expect(error.errorDescription != nil) #expect(error.errorDescription!.lowercased().contains("configured") || error.errorDescription!.lowercased().contains("context")) } /// - Expected Behavior: error conforms to LocalizedError @Test("DataProviderError: conforms to LocalizedError") func dataProviderError_localizedError() { let error: any LocalizedError = DataProviderError.contextNotConfigured #expect(error.errorDescription != nil) } // MARK: - Invariant Tests /// - Invariant: All errors have non-empty descriptions @Test("Invariant: all errors have descriptions") func invariant_allHaveDescriptions() { let errors: [DataProviderError] = [ .contextNotConfigured ] for error in errors { #expect(error.errorDescription != nil) #expect(!error.errorDescription!.isEmpty) } } }