Feat macos (#2)
Android / build-android (release) Successful in 2m18s
Build / build-amd64 (release) Successful in 34s
Build / build-arm64 (release) Canceled after 0s

---------

Co-authored-by: intelligence <intelligence@debian.local>
Co-authored-by: jourintown <jourintown@proton.me>
Reviewed-on: #2
This commit was merged in pull request #2.
This commit is contained in:
jourintownandintelligence committed 2026-08-29 20:30:30 +02:00
1 parent 136bf7cfa3
commit 32e7f32e0a
22 files changed
+1360 -7

No files matched your search

@@ -0,0 +1,30 @@
import XCTest
@testable import Transui
final class TranscriptCleanerTests: XCTestCase {
func testRemovesAsTextPrefix() {
XCTAssertEqual(
TranscriptCleaner.clean("language English<astext>Hello there"),
"Hello there"
)
}
func testRemovesAsrTextPrefix() {
XCTAssertEqual(
TranscriptCleaner.clean("language zh <asr_text>你好"),
"你好"
)
}
func testRemovesPrefixAfterWhitespaceAndBom() {
XCTAssertEqual(
TranscriptCleaner.clean("\u{FEFF} \n\tlanguage English<astext>Hello"),
"Hello"
)
}
func testPreservesOrdinaryTranscript() {
XCTAssertEqual(TranscriptCleaner.clean("language is useful"), "language is useful")
}
}
@@ -0,0 +1,60 @@
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: "")
}
}