Files
OSGKeyboard/OSGKeyboardTests/UtteranceTranscriptGuardTests.swift
T
Rocky 498f407585 feat(account): add managed credits and cloud gateway
Introduce optional Apple account-backed credits with scoped gateway access while preserving local and BYOK paths. Refresh assistant behavior, tests, privacy disclosures, docs, and the website for the 2.0 experience.
2026-08-20 11:43:21 +08:00

33 lines
1.1 KiB
Swift

// UtteranceTranscriptGuardTests.swift
// OSGKeyboardTests
@testable import OSGKeyboardShared
import XCTest
final class UtteranceTranscriptGuardTests: XCTestCase {
func testResolvePrefersPartialWhenClearlyLonger() {
let resolved = UtteranceTranscriptGuard.resolve(
stitchedFinal: "今天天气很好",
partialSnapshot: "今天天气很好,我们一起去公园吧"
)
XCTAssertEqual(resolved, "今天天气很好,我们一起去公园吧")
}
func testResolveKeepsFinalWhenPartialIsNotLonger() {
let resolved = UtteranceTranscriptGuard.resolve(
stitchedFinal: "今天天气很好,我们一起去公园吧",
partialSnapshot: "今天天气很好"
)
XCTAssertEqual(resolved, "今天天气很好,我们一起去公园吧")
}
func testResolveUsesPartialWhenFinalEmpty() {
let resolved = UtteranceTranscriptGuard.resolve(
stitchedFinal: "",
partialSnapshot: "最后一段 partial"
)
XCTAssertEqual(resolved, "最后一段 partial")
}
}