fix: skip silent recordings instead of transcribing them

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 09:58:09 +02:00
co-authored by Claude Sonnet 5.5
parent 835b8bb46b
commit 479169b258
2 changed files with 27 additions and 1 deletions
@@ -45,6 +45,23 @@ struct DictationControllerTests {
#expect(inserter.inserted.isEmpty)
}
@Test func silentRecordingIsDiscarded() async {
recorder.samples = [Float](repeating: 0, count: 16_000)
let controller = makeController()
var states: [DictationState] = []
var errors: [String] = []
controller.onStateChange = { states.append($0) }
controller.onError = { errors.append($0) }
await controller.handle(.pressed)
await controller.handle(.released)
#expect(states == [.recording, .idle])
#expect(transcriber.callCount == 0)
#expect(inserter.inserted.isEmpty)
#expect(errors.isEmpty)
}
@Test func emptyTranscriptionIsNotInserted() async {
recorder.samples = Self.oneSecond
transcriber.result = .success(" \n")