@@ -312,6 +312,30 @@ final class WebRTCCoordinatorStateMachine_JoiningStageTests: XCTestCase, @unchec
312
312
cancellable. cancel ( )
313
313
}
314
314
315
+ func test_transition_fromConnected_configuresAudioSession( ) async throws {
316
+ subject. context. coordinator = mockCoordinatorStack. coordinator
317
+ subject. context. reconnectAttempts = 11
318
+ await mockCoordinatorStack
319
+ . coordinator
320
+ . stateAdapter
321
+ . set ( sfuAdapter: mockCoordinatorStack. sfuStack. adapter)
322
+ mockCoordinatorStack. webRTCAuthenticator. stubbedFunction [ . waitForConnect] = Result < Void , Error > . success ( ( ) )
323
+ let cancellable = receiveEvent (
324
+ . sfuEvent( . joinResponse( Stream_Video_Sfu_Event_JoinResponse ( ) ) ) ,
325
+ every: 0.3
326
+ )
327
+
328
+ try await assertTransition (
329
+ from: . connected,
330
+ expectedTarget: . joined,
331
+ subject: subject
332
+ ) {
333
+ let audioSession = await $0. context. coordinator? . stateAdapter. audioSession
334
+ XCTAssertNotNil ( audioSession? . delegate)
335
+ }
336
+ cancellable. cancel ( )
337
+ }
338
+
315
339
func test_transition_fromConnectedSFUConnected_updatesParticipants( ) async throws {
316
340
subject. context. coordinator = mockCoordinatorStack. coordinator
317
341
subject. context. reconnectAttempts = 11
@@ -730,6 +754,30 @@ final class WebRTCCoordinatorStateMachine_JoiningStageTests: XCTestCase, @unchec
730
754
cancellable. cancel ( )
731
755
}
732
756
757
+ func test_transition_fromConnectedWithRejoin_configuresAudioSession( ) async throws {
758
+ subject. context. coordinator = mockCoordinatorStack. coordinator
759
+ subject. context. isRejoiningFromSessionID = . unique
760
+ await mockCoordinatorStack
761
+ . coordinator
762
+ . stateAdapter
763
+ . set ( sfuAdapter: mockCoordinatorStack. sfuStack. adapter)
764
+ mockCoordinatorStack. webRTCAuthenticator. stubbedFunction [ . waitForConnect] = Result < Void , Error > . success ( ( ) )
765
+ let cancellable = receiveEvent (
766
+ . sfuEvent( . joinResponse( Stream_Video_Sfu_Event_JoinResponse ( ) ) ) ,
767
+ every: 0.3
768
+ )
769
+
770
+ try await assertTransition (
771
+ from: . connected,
772
+ expectedTarget: . joined,
773
+ subject: subject
774
+ ) {
775
+ let audioSession = await $0. context. coordinator? . stateAdapter. audioSession
776
+ XCTAssertNotNil ( audioSession? . delegate)
777
+ }
778
+ cancellable. cancel ( )
779
+ }
780
+
733
781
func test_transition_fromConnectedWithRejoinSFUConnected_updatesParticipantsAndFiltersOutUserWithPreviousSessionId(
734
782
) async throws {
735
783
subject. context. coordinator = mockCoordinatorStack. coordinator
@@ -1357,6 +1405,31 @@ final class WebRTCCoordinatorStateMachine_JoiningStageTests: XCTestCase, @unchec
1357
1405
cancellable. cancel ( )
1358
1406
}
1359
1407
1408
+ func test_transition_fromMigrated_configuresAudioSession( ) async throws {
1409
+ subject. context. coordinator = mockCoordinatorStack. coordinator
1410
+ subject. context. reconnectAttempts = 11
1411
+ subject. context. migratingFromSFU = " test-sfu "
1412
+ await mockCoordinatorStack
1413
+ . coordinator
1414
+ . stateAdapter
1415
+ . set ( sfuAdapter: mockCoordinatorStack. sfuStack. adapter)
1416
+ mockCoordinatorStack. webRTCAuthenticator. stubbedFunction [ . waitForConnect] = Result < Void , Error > . success ( ( ) )
1417
+ let cancellable = receiveEvent (
1418
+ . sfuEvent( . joinResponse( Stream_Video_Sfu_Event_JoinResponse ( ) ) ) ,
1419
+ every: 0.3
1420
+ )
1421
+
1422
+ try await assertTransition (
1423
+ from: . migrated,
1424
+ expectedTarget: . joined,
1425
+ subject: subject
1426
+ ) {
1427
+ let audioSession = await $0. context. coordinator? . stateAdapter. audioSession
1428
+ XCTAssertNotNil ( audioSession? . delegate)
1429
+ }
1430
+ cancellable. cancel ( )
1431
+ }
1432
+
1360
1433
func test_transition_fromMigratedSFUConnected_updatesParticipants( ) async throws {
1361
1434
subject. context. coordinator = mockCoordinatorStack. coordinator
1362
1435
subject. context. reconnectAttempts = 11
0 commit comments