@@ -10,30 +10,24 @@ final class OwnCapabilitiesAudioSessionPolicyTests: XCTestCase, @unchecked Senda
1010
1111 private lazy var stubbedAppStateAdapter : MockAppStateAdapter ! = . init( )
1212 private lazy var subject : OwnCapabilitiesAudioSessionPolicy ! = . init( )
13- private lazy var currentDeviceType : CurrentDevice . DeviceType ! = CurrentDevice . DeviceType. phone
14- private lazy var currentDevice : CurrentDevice ! = . init { self . currentDeviceType }
1513
1614 override func setUp( ) {
1715 super. setUp ( )
1816 AppStateProviderKey . currentValue = stubbedAppStateAdapter
19- InjectedValues [ \. currentDevice] = currentDevice
2017 _ = subject
2118 }
2219
2320 override func tearDown( ) {
2421 subject = nil
2522 stubbedAppStateAdapter = nil
26- currentDevice = nil
27- InjectedValues [ \. currentDevice] = CurrentDevice . currentValue
2823 super. tearDown ( )
2924 }
3025
3126 // MARK: - Tests for users without sendAudio capability
3227
3328 func testConfiguration_WhenUserCannotSendAudio_ReturnsPlaybackConfiguration( ) async {
3429 // Given
35- currentDeviceType = . phone
36- await fulfilmentInMainActor { self . currentDevice. deviceType == self . currentDeviceType }
30+ CurrentDevice . currentValue. didUpdate ( . phone)
3731 let callSettings = CallSettings ( audioOn: true , videoOn: true , speakerOn: true )
3832 let ownCapabilities : Set < OwnCapability > = [ . sendVideo]
3933
@@ -54,8 +48,7 @@ final class OwnCapabilitiesAudioSessionPolicyTests: XCTestCase, @unchecked Senda
5448
5549 func testConfiguration_WhenUserCanSendAudioAndAudioOn_ReturnsPlayAndRecordConfiguration( ) async {
5650 // Given
57- currentDeviceType = . phone
58- await fulfilmentInMainActor { self . currentDevice. deviceType == self . currentDeviceType }
51+ CurrentDevice . currentValue. didUpdate ( . phone)
5952 let callSettings = CallSettings ( audioOn: true , videoOn: true , speakerOn: false )
6053 let ownCapabilities : Set < OwnCapability > = [ . sendAudio, . sendVideo]
6154
@@ -80,8 +73,7 @@ final class OwnCapabilitiesAudioSessionPolicyTests: XCTestCase, @unchecked Senda
8073
8174 func testConfiguration_WhenUserCanSendAudioAndSpeakerOnWithEarpiece_ReturnsPlayAndRecordConfiguration( ) async {
8275 // Given
83- currentDeviceType = . phone
84- await fulfilmentInMainActor { self . currentDevice. deviceType == self . currentDeviceType }
76+ CurrentDevice . currentValue. didUpdate ( . phone)
8577 let callSettings = CallSettings ( audioOn: false , videoOn: true , speakerOn: true )
8678 let ownCapabilities : Set < OwnCapability > = [ . sendAudio, . sendVideo]
8779
@@ -106,8 +98,7 @@ final class OwnCapabilitiesAudioSessionPolicyTests: XCTestCase, @unchecked Senda
10698
10799 func testConfiguration_WhenUserCanSendAudioAndSpeakerOnWithoutEarpiece_ReturnsPlaybackAndRecordConfiguration( ) async {
108100 // Given
109- currentDeviceType = . pad
110- await fulfilmentInMainActor { self . currentDevice. deviceType == self . currentDeviceType }
101+ CurrentDevice . currentValue. didUpdate ( . pad)
111102 let callSettings = CallSettings ( audioOn: false , videoOn: true , speakerOn: true )
112103 let ownCapabilities : Set < OwnCapability > = [ . sendAudio, . sendVideo]
113104
@@ -126,8 +117,7 @@ final class OwnCapabilitiesAudioSessionPolicyTests: XCTestCase, @unchecked Senda
126117
127118 func testConfiguration_WhenUserCanSendAudioAndAudioOff_ReturnsPlaybackConfiguration( ) async {
128119 // Given
129- currentDeviceType = . phone
130- await fulfilmentInMainActor { self . currentDevice. deviceType == self . currentDeviceType }
120+ CurrentDevice . currentValue. didUpdate ( . phone)
131121 let callSettings = CallSettings ( audioOn: false , videoOn: true , speakerOn: false )
132122 let ownCapabilities : Set < OwnCapability > = [ . sendAudio, . sendVideo]
133123
@@ -148,8 +138,7 @@ final class OwnCapabilitiesAudioSessionPolicyTests: XCTestCase, @unchecked Senda
148138
149139 func testConfiguration_WhenVideoOffSpeakerOnBackgroundFalse_ReturnsVoiceChatMode( ) async {
150140 // Given
151- currentDeviceType = . phone
152- await fulfilmentInMainActor { self . currentDevice. deviceType == self . currentDeviceType }
141+ CurrentDevice . currentValue. didUpdate ( . phone)
153142 let callSettings = CallSettings ( audioOn: true , videoOn: false , speakerOn: true )
154143 let ownCapabilities : Set < OwnCapability > = [ . sendAudio, . sendVideo]
155144
@@ -172,8 +161,7 @@ final class OwnCapabilitiesAudioSessionPolicyTests: XCTestCase, @unchecked Senda
172161
173162 func testConfiguration_WhenVideoOffSpeakerFalseBackgroundFalse_ReturnsVoiceChatMode( ) async {
174163 // Given
175- currentDeviceType = . phone
176- await fulfilmentInMainActor { self . currentDevice. deviceType == self . currentDeviceType }
164+ CurrentDevice . currentValue. didUpdate ( . phone)
177165 let callSettings = CallSettings ( audioOn: true , videoOn: false , speakerOn: false )
178166 let ownCapabilities : Set < OwnCapability > = [ . sendAudio, . sendVideo]
179167
@@ -196,8 +184,7 @@ final class OwnCapabilitiesAudioSessionPolicyTests: XCTestCase, @unchecked Senda
196184
197185 func testConfiguration_WhenVideoOffSpeakerOnBackgroundTrue_ReturnsVoiceChatMode( ) async {
198186 // Given
199- currentDeviceType = . phone
200- await fulfilmentInMainActor { self . currentDevice. deviceType == self . currentDeviceType }
187+ CurrentDevice . currentValue. didUpdate ( . phone)
201188 stubbedAppStateAdapter. stubbedState = . background
202189 let callSettings = CallSettings ( audioOn: true , videoOn: false , speakerOn: true )
203190 let ownCapabilities : Set < OwnCapability > = [ . sendAudio, . sendVideo]
@@ -221,8 +208,7 @@ final class OwnCapabilitiesAudioSessionPolicyTests: XCTestCase, @unchecked Senda
221208
222209 func testConfiguration_WhenVideoOffSpeakerFalseBackgroundTrue_ReturnsVoiceChatMode( ) async {
223210 // Given
224- currentDeviceType = . phone
225- await fulfilmentInMainActor { self . currentDevice. deviceType == self . currentDeviceType }
211+ CurrentDevice . currentValue. didUpdate ( . phone)
226212 stubbedAppStateAdapter. stubbedState = . background
227213 let callSettings = CallSettings ( audioOn: true , videoOn: false , speakerOn: false )
228214 let ownCapabilities : Set < OwnCapability > = [ . sendAudio, . sendVideo]
0 commit comments