mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
add test for voice call
This commit is contained in:
@@ -49,6 +49,34 @@ final class ElementCallServiceTests {
|
||||
}
|
||||
|
||||
#expect(callProvider.reportNewIncomingCallWithUpdateCompletionCalled)
|
||||
// Verify the provider was called with a CXCallUpdate that has video enabled
|
||||
if let args = callProvider.reportNewIncomingCallWithUpdateCompletionReceivedArguments {
|
||||
#expect(args.update.hasVideo == true)
|
||||
} else {
|
||||
Issue.record("Expected reportNewIncomingCallWithUpdateCompletionReceivedArguments to be captured")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func incomingVoiceCall() async {
|
||||
#expect(!callProvider.reportNewIncomingCallWithUpdateCompletionCalled)
|
||||
|
||||
await confirmation { confirmation in
|
||||
let pkPushPayloadMock = PKPushPayloadMock().updatingExpiration(currentDate, lifetime: 30)
|
||||
.updateIsVoice(true)
|
||||
|
||||
service.pushRegistry(pushRegistry, didReceiveIncomingPushWith: pkPushPayloadMock, for: .voIP) {
|
||||
confirmation()
|
||||
}
|
||||
}
|
||||
|
||||
#expect(callProvider.reportNewIncomingCallWithUpdateCompletionCalled)
|
||||
// Verify the provider was called with a CXCallUpdate that has video enabled
|
||||
if let args = callProvider.reportNewIncomingCallWithUpdateCompletionReceivedArguments {
|
||||
#expect(args.update.hasVideo == false)
|
||||
} else {
|
||||
Issue.record("Expected reportNewIncomingCallWithUpdateCompletionReceivedArguments to be captured")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -138,4 +166,9 @@ private class PKPushPayloadMock: PKPushPayload {
|
||||
dict[ElementCallServiceNotificationKey.expirationDate.rawValue] = from.addingTimeInterval(lifetime)
|
||||
return self
|
||||
}
|
||||
|
||||
func updateIsVoice(_ isVoice: Bool) -> Self {
|
||||
dict[ElementCallServiceNotificationKey.isVoiceCall.rawValue] = isVoice
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user