498f407585
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.
33 lines
1.1 KiB
Swift
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")
|
|
}
|
|
}
|