Added a process command for recording processing on the RecordingCommand enum in the Commanding package target.

This commit is contained in:
2026-07-06 03:34:21 +02:00
parent 380ffc39b3
commit ffa80d3b58
3 changed files with 23 additions and 0 deletions
@@ -4,4 +4,6 @@ public enum RecordingCommand: Equatable, Sendable {
case toggle
/// Discards the recording, like a press of the feature's discard button.
case discard
/// Sends the paused recording for processing, like a press of the feature's send button.
case process
}
@@ -436,6 +436,8 @@ private extension RecordingView.Model {
pressedMain()
case .discard:
pressedDiscard()
case .process:
pressedSend()
}
}
}
@@ -944,6 +944,25 @@ struct RecordingViewModelTests {
#expect(model.elapsedSeconds == 0)
}
@Test
func `a process command sends a paused recording for processing`() async throws {
let commander = RecordingCommander()
let model = Model(
transcribe: TranscribingMock(),
commander: commander
)
model.drive(to: .paused)
try await Task.sleep(for: .seconds(0.1))
commander.send(.process)
try await Task.sleep(for: .seconds(0.1))
#expect(model.state == .processing)
}
@Test
func `commands are ignored before the first recording starts`() async throws {
let commander = RecordingCommander()