@@ -27,7 +27,7 @@ class ElementCallServiceTests: XCTestCase {
2727
2828 let expectation = XCTestExpectation ( description: " Call accepted " )
2929
30- let pkPushPayloadMock = PKPushPayloadMock ( ) . addSeconds ( currentDate, lifetime: 30 )
30+ let pkPushPayloadMock = PKPushPayloadMock ( ) . updatingExpiration ( currentDate, lifetime: 30 )
3131
3232 service. pushRegistry ( pushRegistry, didReceiveIncomingPushWith: pkPushPayloadMock, for: . voIP) {
3333 expectation. fulfill ( )
@@ -44,7 +44,7 @@ class ElementCallServiceTests: XCTestCase {
4444
4545 let expectation = XCTestExpectation ( description: " Call accepted " )
4646
47- let pushPayload = PKPushPayloadMock ( ) . addSeconds ( currentDate, lifetime: 20 )
47+ let pushPayload = PKPushPayloadMock ( ) . updatingExpiration ( currentDate, lifetime: 20 )
4848
4949 service. pushRegistry ( pushRegistry,
5050 didReceiveIncomingPushWith: pushPayload,
@@ -66,7 +66,7 @@ class ElementCallServiceTests: XCTestCase {
6666
6767 XCTAssertFalse ( callProvider. reportNewIncomingCallWithUpdateCompletionCalled)
6868
69- let pushPayload = PKPushPayloadMock ( ) . addSeconds ( currentDate, lifetime: 20 )
69+ let pushPayload = PKPushPayloadMock ( ) . updatingExpiration ( currentDate, lifetime: 20 )
7070
7171 currentDate = currentDate. addingTimeInterval ( 60 )
7272
@@ -83,7 +83,7 @@ class ElementCallServiceTests: XCTestCase {
8383
8484 XCTAssertFalse ( callProvider. reportNewIncomingCallWithUpdateCompletionCalled)
8585
86- let pushPayload = PKPushPayloadMock ( ) . addSeconds ( currentDate, lifetime: 300 )
86+ let pushPayload = PKPushPayloadMock ( ) . updatingExpiration ( currentDate, lifetime: 300 )
8787
8888 service. pushRegistry ( pushRegistry,
8989 didReceiveIncomingPushWith: pushPayload,
@@ -106,7 +106,7 @@ class ElementCallServiceTests: XCTestCase {
106106 let dateProvider : ( ) -> Date = {
107107 self . currentDate
108108 }
109- service = ElementCallService ( callProvider: callProvider, timeClock : Time ( clock: testClock, now: dateProvider) )
109+ service = ElementCallService ( callProvider: callProvider, timeProvider : TimeProvider ( clock: testClock, now: dateProvider) )
110110 }
111111}
112112
@@ -124,8 +124,8 @@ private class PKPushPayloadMock: PKPushPayload {
124124 dict
125125 }
126126
127- func addSeconds ( _ from: Date , lifetime: Int ) -> Self {
128- dict [ ElementCallServiceNotificationKey . expirationDate. rawValue] = from. addingTimeInterval ( TimeInterval ( lifetime) )
127+ func updatingExpiration ( _ from: Date , lifetime: TimeInterval ) -> Self {
128+ dict [ ElementCallServiceNotificationKey . expirationDate. rawValue] = from. addingTimeInterval ( lifetime)
129129 return self
130130 }
131131}
0 commit comments