import Testing
@testable import 康康

struct SpeechDictationMergeTests {
    @Test func emptyPrefixReturnsPartial() {
        #expect(SpeechDictationService.merge(prefix: "", partial: "今天头晕") == "今天头晕")
    }

    @Test func plainPrefixJoinsWithSpace() {
        #expect(SpeechDictationService.merge(prefix: "已有内容", partial: "新听写")
                == "已有内容 新听写")
    }

    @Test func whitespaceTerminatedPrefixConcatsDirectly() {
        #expect(SpeechDictationService.merge(prefix: "第一行\n", partial: "新听写")
                == "第一行\n新听写")
    }

    @Test func emptyPartialKeepsPrefix() {
        #expect(SpeechDictationService.merge(prefix: "已有内容", partial: "") == "已有内容")
    }
}
