Files
OSGKeyboard/OSGKeyboardTests/FlowASRPostProcessorTests.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

41 lines
1.4 KiB
Swift

// FlowASRPostProcessorTests.swift
// OSGKeyboardTests
@testable import OSGKeyboard
@testable import OSGKeyboardShared
import XCTest
final class FlowASRPostProcessorTests: XCTestCase {
func testLocalASRAppliesDictionaryAliasesToRawAndPolishInputs() throws {
var dictionary = PersonalDictionary.empty
let entry = try XCTUnwrap(dictionary.upsertManual(term: "SwiftUI"))
dictionary.updateAliases(for: entry.id, aliases: ["swift u i"])
let result = FlowASRPostProcessor.process(
text: "请介绍 swift u i",
textForPolish: "请介绍 swift u i。",
engineMode: "local",
dictionary: dictionary
)
XCTAssertEqual(result.text, "请介绍 SwiftUI")
XCTAssertEqual(result.textForPolish, "请介绍 SwiftUI。")
}
func testCloudASRLeavesProviderBiasedTranscriptUnchanged() throws {
var dictionary = PersonalDictionary.empty
let entry = try XCTUnwrap(dictionary.upsertManual(term: "SwiftUI"))
dictionary.updateAliases(for: entry.id, aliases: ["swift u i"])
let result = FlowASRPostProcessor.process(
text: "请介绍 swift u i",
textForPolish: "请介绍 swift u i。",
engineMode: "cloud",
dictionary: dictionary
)
XCTAssertEqual(result.text, "请介绍 swift u i")
XCTAssertEqual(result.textForPolish, "请介绍 swift u i。")
}
}