Skip to content

Fastest and only macOS Dictation app with on-device STT and custom trained AI enhancement model. Windows, iOS testflight! Android, Linux waitlist open! A local Wispr Flow alternative. Follow https://x.com/fluidvoiceapp for more

test(meeting): wait for the preflight continuation before resuming it (#1069)

postoso1a8be17309fd
diff --git a/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift b/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift
index 7d86c9f0..5de212ec 100644
--- a/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift
+++ b/Tests/FluidDictationIntegrationTests/MeetingRecoveryTests.swift
@@ -2273,17 +2273,19 @@ final class MeetingRecoveryTests: XCTestCase {
let capture = StubCaptureController()
capture.startResult = MeetingCaptureStartResult(tracks: [self.makeMicrophoneTrack(chunks: [])], firstPresentationTime: nil)
var continuation: CheckedContinuation<Void, Never>?
+ let preflightReached = self.expectation(description: "preflight suspended")
capture.onPreflight = {
- await withCheckedContinuation { continuation = $0 }
+ await withCheckedContinuation {
+ continuation = $0
+ preflightReached.fulfill()
+ }
}
let arbiter = StubArbiter()
let coordinator = MeetingSessionCoordinator(
store: store, capture: capture, processing: StubProcessingController(), audioArbiter: arbiter
)
let start = Task { try await coordinator.startRecording(configuration: self.makeConfiguration()) }
- while capture.preflightCount == 0 {
- await Task.yield()
- }
+ await self.fulfillment(of: [preflightReached], timeout: 2)
do {
_ = try await coordinator.retryProcessing(sessionID: UUID())
@@ -2327,7 +2329,13 @@ final class MeetingRecoveryTests: XCTestCase {
defer { try? FileManager.default.removeItem(at: dir) }
let capture = StubCaptureController()
var continuation: CheckedContinuation<Void, Never>?
- capture.onPreflight = { await withCheckedContinuation { continuation = $0 } }
+ let preflightReached = self.expectation(description: "preflight suspended")
+ capture.onPreflight = {
+ await withCheckedContinuation {
+ continuation = $0
+ preflightReached.fulfill()
+ }
+ }
let coordinator = MeetingSessionCoordinator(
store: MeetingSessionStore(rootDirectory: dir),
capture: capture,
@@ -2335,9 +2343,7 @@ final class MeetingRecoveryTests: XCTestCase {
audioArbiter: StubArbiter()
)
let start = Task { try await coordinator.startRecording(configuration: self.makeConfiguration()) }
- while capture.preflightCount == 0 {
- await Task.yield()
- }
+ await self.fulfillment(of: [preflightReached], timeout: 2)
await coordinator.shutdownForTermination()
continuation?.resume()
do {
@@ -4253,8 +4259,12 @@ final class MeetingRecoveryTests: XCTestCase {
capture.startResult = MeetingCaptureStartResult(tracks: [self.makeMicrophoneTrack(chunks: [])], firstPresentationTime: nil)
let arbiter = StubArbiter()
var continuation: CheckedContinuation<Void, Never>?
+ let preflightReached = self.expectation(description: "preflight suspended")
capture.onPreflight = {
- await withCheckedContinuation { continuation = $0 }
+ await withCheckedContinuation {
+ continuation = $0
+ preflightReached.fulfill()
+ }
}
let coordinator = MeetingSessionCoordinator(
store: MeetingSessionStore(rootDirectory: dir),
@@ -4264,9 +4274,7 @@ final class MeetingRecoveryTests: XCTestCase {
)
let start = Task { try await coordinator.startRecording(configuration: self.makeConfiguration()) }
- while capture.preflightCount == 0 {
- await Task.yield()
- }
+ await self.fulfillment(of: [preflightReached], timeout: 2)
XCTAssertEqual(arbiter.acquireCount, 0, "permission prompt must not hold the meeting audio lease")
continuation?.resume()