import XCTest @testable import Transui final class TranscriptionClientTests: XCTestCase { func testAddsTranscriptionPath() { XCTAssertEqual( TranscriptionClient.endpointURL(from: "https://example.com/")?.absoluteString, "https://example.com/v1/audio/transcriptions" ) } func testKeepsFullTranscriptionPath() { XCTAssertEqual( TranscriptionClient.endpointURL( from: "https://example.com/v1/audio/transcriptions" )?.absoluteString, "https://example.com/v1/audio/transcriptions" ) } func testRejectsInvalidEndpoint() { XCTAssertNil(TranscriptionClient.endpointURL(from: "")) XCTAssertNil(TranscriptionClient.endpointURL(from: "example.com")) } func testHostedFirstPlanFallsBackToLocal() { let plan = TranscriptionPlan( hosted: endpoint("Hosted", "https://hosted.example.com"), local: endpoint("Local", "http://localhost:8080"), hostedFirst: true ) XCTAssertEqual(plan.endpoints.map(\.label), ["Hosted", "Local"]) } func testDisabledHostedFirstUsesOnlyLocal() { let plan = TranscriptionPlan( hosted: endpoint("Hosted", "https://hosted.example.com"), local: endpoint("Local", "http://localhost:8080"), hostedFirst: false ) XCTAssertEqual(plan.endpoints.map(\.label), ["Local"]) } func testPlanSkipsEmptyEndpoints() { let plan = TranscriptionPlan( hosted: endpoint("Hosted", ""), local: endpoint("Local", ""), hostedFirst: true ) XCTAssertTrue(plan.endpoints.isEmpty) } private func endpoint(_ label: String, _ value: String) -> TranscriptionEndpoint { TranscriptionEndpoint(label: label, endpoint: value, model: "", key: "") } }