fix: skip silent recordings instead of transcribing them
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user