@@ -28,7 +28,7 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
2828 type: " admin "
2929 )
3030 }
31-
31+
3232 func testUserAsync_CreateUser( ) async throws {
3333 let user = testableUser ( )
3434 let createdUser = try await chat. createUser ( user: user)
@@ -70,7 +70,7 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
7070 XCTAssertEqual ( updatedUser. status, " inactive " )
7171 XCTAssertEqual ( updatedUser. type, " regular " )
7272 }
73-
73+
7474 func testUserAsync_UpdateUserCallback( ) async throws {
7575 try await chat. currentUser. update (
7676 name: " Markus Koller " ,
@@ -83,7 +83,7 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
8383
8484 // Simulates updating an outdated version of the User object.
8585 // We expect the fresh object from the server to be returned first, and then subsequent updates to be applied on top of it
86- let updateResult = try await chat. currentUser. update ( ) {
86+ let updateResult = try await chat. currentUser. update {
8787 [
8888 . stringOptional( \. name, $0. name? . uppercased ( ) ) ,
8989 . stringOptional( \. status, $0. status? . uppercased ( ) )
@@ -98,23 +98,23 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
9898 let errorExpectation = XCTestExpectation ( description: " ErrorExpectation " )
9999 errorExpectation. assertForOverFulfill = true
100100 errorExpectation. expectedFulfillmentCount = 1
101-
101+
102102 let someUser = testableUser ( )
103-
103+
104104 do {
105105 try await someUser. update ( name: " NewName " , externalId: " NewExternalId " )
106106 } catch {
107107 XCTAssertEqual ( ( error as? ChatError ) ? . message, " User does not exist " )
108108 errorExpectation. fulfill ( )
109109 }
110-
110+
111111 await fulfillment ( of: [ errorExpectation] , timeout: 4 )
112112 }
113113
114114 func testUserAsync_IsPresentOn( ) async throws {
115115 let channelId = randomString ( )
116116 let createdChannel = try await chat. createChannel ( id: channelId, name: channelId)
117-
117+
118118 // Keeping a strong reference to this object for test purposes to simulate that someone is already present on the given channel.
119119 // If this object is not retained, it will be deallocated, resulting in no subscription to the channel,
120120 // which would cause the behavior being tested to fail.
@@ -124,7 +124,7 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
124124 try await Task . sleep ( nanoseconds: 4_000_000_000 )
125125 let isPresent = try await chat. currentUser. isPresentOn ( channelId: createdChannel. id)
126126 XCTAssertTrue ( isPresent)
127-
127+
128128 addTeardownBlock { [ unowned self] in
129129 _ = try ? await chat. deleteChannel ( id: channelId)
130130 }
@@ -140,7 +140,7 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
140140 func testUserAsync_SoftDelete( ) async throws {
141141 let createdUser = try await chat. createUser ( user: testableUser ( ) )
142142 let deletedUser = try await createdUser. delete ( soft: true )
143-
143+
144144 XCTAssertFalse (
145145 deletedUser? . active ?? true
146146 )
@@ -154,41 +154,41 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
154154 func testUserAsync_DeleteNotExistingUser( ) async throws {
155155 let someUser = testableUser ( )
156156 let resultValue = try await someUser. delete ( soft: false )
157-
157+
158158 XCTAssertNil ( resultValue)
159159 }
160160
161161 func testUserAsync_WherePresent( ) async throws {
162162 let channelId = randomString ( )
163163 let channel = try await chat. createChannel ( id: channelId, name: channelId)
164-
164+
165165 // Keeping a strong reference to this object for test purposes to simulate that someone is already present on the given channel.
166166 // If this object is not retained, it will be deallocated, resulting in no subscription to the channel,
167167 // which would cause the behavior being tested to fail.
168168 let connectResult = channel. connect ( )
169169 debugPrint ( connectResult)
170170
171171 try await Task . sleep ( nanoseconds: 5_000_000_000 )
172-
172+
173173 let channelIdentifiers = try await chat. currentUser. wherePresent ( )
174174 let expectedChannelIdentifiers = [ channelId]
175-
175+
176176 XCTAssertEqual (
177177 expectedChannelIdentifiers,
178178 channelIdentifiers
179179 )
180-
180+
181181 addTeardownBlock { [ unowned self] in
182182 _ = try ? await chat. deleteChannel ( id: channel. id)
183183 }
184184 }
185185
186186 func testUserAsync_GetMemberships( ) async throws {
187187 let channel = try await chat. createChannel ( id: randomString ( ) )
188-
188+
189189 try await channel. invite ( user: chat. currentUser)
190190 let getMembershipsValue = try await chat. currentUser. getMemberships ( )
191-
191+
192192 XCTAssertEqual ( try ( XCTUnwrap ( getMembershipsValue. memberships. first) ) . user. id, chat. currentUser. id)
193193 XCTAssertEqual ( try ( XCTUnwrap ( getMembershipsValue. memberships. first) ) . channel. id, channel. id)
194194
@@ -201,9 +201,9 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
201201 let expectation = expectation ( description: " StreamUpdates " )
202202 expectation. assertForOverFulfill = true
203203 expectation. expectedFulfillmentCount = 1
204-
204+
205205 let createdUser = try await chat. createUser ( user: testableUser ( ) )
206-
206+
207207 let task = Task {
208208 for await updatedUser in createdUser. streamUpdates ( ) {
209209 XCTAssertEqual ( updatedUser? . name, " NewName " )
@@ -216,7 +216,7 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
216216 expectation. fulfill ( )
217217 }
218218 }
219-
219+
220220 try await Task . sleep ( nanoseconds: 3_000_000_000 )
221221 try await createdUser. update (
222222 name: " NewName " ,
@@ -227,9 +227,9 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
227227 status: " NewStatus " ,
228228 type: " NewType "
229229 )
230-
230+
231231 await fulfillment ( of: [ expectation] , timeout: 6 )
232-
232+
233233 addTeardownBlock { [ unowned self] in
234234 task. cancel ( )
235235 _ = try ? await chat. deleteUser ( id: createdUser. id)
@@ -255,7 +255,7 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
255255 }
256256 }
257257 }
258-
258+
259259 for user in [ firstUser, secondUser] {
260260 try await Task . sleep ( nanoseconds: 3_000_000_000 )
261261 try await user. update (
@@ -273,7 +273,7 @@ class UserAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
273273 of: [ expectation] ,
274274 timeout: 6
275275 )
276-
276+
277277 addTeardownBlock { [ unowned self] in
278278 task. cancel ( )
279279 _ = try ? await chat. deleteUser ( id: firstUser. id)
0 commit comments