Skip to content

Commit 06defcd

Browse files
committed
SwiftFormat
1 parent 856ed18 commit 06defcd

10 files changed

+153
-153
lines changed

Tests/AsyncAwait/ChatAsyncIntegrationTests.swift

Lines changed: 104 additions & 104 deletions
Large diffs are not rendered by default.

Tests/AsyncAwait/MembershipAsyncIntegrationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ class MembershipAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
6969
let unreadMessagesCount = try await membership.getUnreadMessagesCount()
7070
XCTAssertEqual(unreadMessagesCount, 3)
7171
}
72-
72+
7373
func testMembershipAsync_GetUnreadMessagesCountForEmptyChannel() async throws {
7474
let someMembership = MembershipImpl(
7575
chat: chat,
7676
channel: channel,
7777
user: UserImpl(chat: chat, id: randomString())
7878
)
79-
79+
8080
let unreadMessagesCount = try await someMembership.getUnreadMessagesCount()
8181
XCTAssertNil(unreadMessagesCount)
8282
}

Tests/AsyncAwait/MessageAsyncIntegrationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class MessageAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
3232
testMessage = nil
3333
channel = nil
3434
}
35-
35+
3636
func testMessageAsync_HasNoUserReaction() async throws {
3737
let someMessage = MessageImpl(
3838
chat: chat,

Tests/AsyncAwait/MessageDraftAsyncIntegrationTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ class MessageDraftIntegrationTests: BaseAsyncIntegrationTestCase {
2020
override func customSetup() async throws {
2121
let channelId = "cchnl\(randomString())"
2222
let userId = "uuser\(randomString())"
23-
23+
2424
channel = try await chat.createChannel(id: channelId, name: channelId)
2525
user = try await chat.createUser(user: UserImpl(chat: chat, id: userId, name: userId))
26-
26+
2727
try await channel.invite(user: user)
2828
}
29-
29+
3030
override func customTearDown() async throws {
3131
_ = try? await chat.deleteUser(id: user.id)
3232
_ = try? await chat.deleteChannel(id: channel.id)
@@ -60,7 +60,7 @@ class MessageDraftIntegrationTests: BaseAsyncIntegrationTestCase {
6060
messageDraft.update(text: "This is a @uuser")
6161

6262
await fulfillment(of: [expectation], timeout: 6)
63-
63+
6464
let timetoken = try await messageDraft.send()
6565
try await Task.sleep(nanoseconds: 3_000_000_000)
6666
let message = try await channel.getMessage(timetoken: timetoken)
@@ -104,7 +104,7 @@ class MessageDraftIntegrationTests: BaseAsyncIntegrationTestCase {
104104
messageDraft.update(text: "This is a #cchnl")
105105

106106
await fulfillment(of: [expectation], timeout: 6)
107-
107+
108108
let timetoken = try await messageDraft.send()
109109
try await Task.sleep(nanoseconds: 3_000_000_000)
110110
let message = try await channel.getMessage(timetoken: timetoken)

Tests/AsyncAwait/ThreadChannelAsyncIntegrationTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ class ThreadChannelAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
2020

2121
override func customSetup() async throws {
2222
parentChannel = try await chat.createChannel(id: randomString())
23-
23+
2424
let timetoken = try await parentChannel.sendText(text: "Message")
2525
try await Task.sleep(nanoseconds: 3_000_000_000)
26-
26+
2727
let testMessage = try await parentChannel.getMessage(timetoken: timetoken)
2828
let unwrappedTestMessage = try XCTUnwrap(testMessage)
29-
29+
3030
threadChannel = try await unwrappedTestMessage.createThread()
31-
31+
3232
try await threadChannel.sendText(text: "Reply in a thread")
3333
}
34-
34+
3535
override func customTearDown() async throws {
3636
_ = try? await parentChannel.delete()
3737
_ = try? await threadChannel.delete()
@@ -42,10 +42,10 @@ class ThreadChannelAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
4242

4343
let message = try await threadChannel.getHistory().messages.first
4444
let unwrappedMessage = try XCTUnwrap(message)
45-
45+
4646
let updatedChannel = try await threadChannel.pinMessageToParentChannel(message: unwrappedMessage)
4747
let pinnedMessage = try await updatedChannel.getPinnedMessage()
48-
48+
4949
XCTAssertNotNil(pinnedMessage)
5050
}
5151
}

Tests/AsyncAwait/ThreadMessageAsyncIntegrationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ThreadMessageaAsyncIntegrationTests: BaseAsyncIntegrationTestCase {
4747
func testThreadMessageAsync_HasNoUserReactions() throws {
4848
XCTAssertFalse(threadMessage.hasUserReaction(reaction: "someReaction"))
4949
}
50-
50+
5151
func testThreadMessageAsync_EditText() async throws {
5252
let currentMessageText = threadMessage.text
5353
let newText = "NewTextValue"

Tests/AsyncAwait/UserAsyncIntegrationTests.swift

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -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)

Tests/BaseClosureIntegrationTestCase.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ extension BaseClosureIntegrationTestCase {
4444
// This extension uses `XCTestExpectation` to flatten the structure of closure-based tests,
4545
// reducing the need for nested closures. It allows tests to appear sequential and easier
4646
// to follow without changing the underlying closure-based behavior.
47-
///
47+
//
4848
// This is not a replacement for Swift's native `async-await` but rather a way to improve
4949
// the readability of tests that involve multiple asynchronous calls with completion handlers.
5050
extension BaseClosureIntegrationTestCase {

Tests/ChatIntegrationTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,22 @@ class ChatIntegrationTests: BaseClosureIntegrationTestCase {
7878
}
7979
}
8080
}
81-
81+
8282
func testChat_UpdateUser() throws {
8383
let newCustom: [String: JSONCodableScalar] = [
8484
"someValue": 17_253_575_019_298_112,
8585
"someStr": "str"
8686
]
87-
87+
8888
let userId = randomString()
89-
89+
9090
try awaitResultValue {
9191
chat.createUser(
9292
id: userId,
9393
completion: $0
9494
)
9595
}
96-
96+
9797
let updatedUser = try awaitResultValue {
9898
chat.updateUser(
9999
id: userId,
@@ -116,7 +116,7 @@ class ChatIntegrationTests: BaseClosureIntegrationTestCase {
116116
XCTAssertEqual(updatedUser.custom?.mapValues { $0.scalarValue }, newCustom.mapValues { $0.scalarValue })
117117
XCTAssertEqual(updatedUser.status, "offline")
118118
XCTAssertEqual(updatedUser.type, "regular")
119-
119+
120120
addTeardownBlock { [unowned self] in
121121
try awaitResult {
122122
chat.deleteUser(
@@ -868,14 +868,14 @@ class ChatIntegrationTests: BaseClosureIntegrationTestCase {
868868
completion: $0
869869
)
870870
}
871-
871+
872872
let tt = try awaitResultValue {
873873
channel.sendText(
874874
text: "Some text",
875875
completion: $0
876876
)
877877
}
878-
878+
879879
try awaitResultValue(delay: 2) {
880880
chat.emitEvent(
881881
channelId: chat.currentUser.id,

Tests/UserIntegrationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ final class UserIntegrationTests: BaseClosureIntegrationTestCase {
4646
try awaitResult { chat.deleteUser(
4747
id: user.id,
4848
completion: $0
49-
)}
49+
) }
5050
}
5151
}
5252

@@ -170,7 +170,7 @@ final class UserIntegrationTests: BaseClosureIntegrationTestCase {
170170
completion: $0
171171
)
172172
}
173-
173+
174174
XCTAssertFalse(
175175
deletedUser?.active ?? true
176176
)

0 commit comments

Comments
 (0)