Skip to content

Commit fb24bd3

Browse files
authored
chore: Fixing Xcode syntax warnings/suggestions. (#2676)
1 parent f85c85c commit fb24bd3

File tree

16 files changed

+34
-94
lines changed

16 files changed

+34
-94
lines changed

AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLIAMTests/GraphQLWithIAMIntegrationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class GraphQLWithIAMIntegrationTests: XCTestCase {
220220
}
221221

222222
func signOut() async {
223-
await Amplify.Auth.signOut()
223+
_ = await Amplify.Auth.signOut()
224224
}
225225

226226
// MARK: - Model

AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginGraphQLUserPoolTests/GraphQLWithUserPoolIntegrationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ class GraphQLWithUserPoolIntegrationTests: XCTestCase {
326326
}
327327
XCTAssertTrue(!listTodos.items.isEmpty)
328328
case .failure(let error):
329-
print("\(error.underlyingError)")
329+
print("\(String(describing: error.underlyingError))")
330330
XCTFail("Unexpected .failed event: \(error)")
331331
}
332332
}

AmplifyPlugins/API/Tests/APIHostApp/AWSAPIPluginRESTUserPoolTests/RESTWithUserPoolIntegrationTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class RESTWithUserPoolIntegrationTests: XCTestCase {
3636

3737
override func tearDown() async throws {
3838
if try await isSignedIn() {
39-
try await signOut()
39+
await signOut()
4040
}
4141
await Amplify.reset()
4242
}
@@ -93,7 +93,7 @@ class RESTWithUserPoolIntegrationTests: XCTestCase {
9393
}
9494

9595
func testGetAPIFailedWithSignedOutError() async throws {
96-
try await signOut()
96+
await signOut()
9797
let request = RESTRequest(path: "/items")
9898
do {
9999
_ = try await Amplify.API.get(request: request)
@@ -125,7 +125,7 @@ class RESTWithUserPoolIntegrationTests: XCTestCase {
125125

126126
func createAuthenticatedUser() async throws {
127127
if try await isSignedIn() {
128-
try await signOut()
128+
await signOut()
129129
}
130130
try await signUp()
131131
try await signIn()
@@ -154,7 +154,7 @@ class RESTWithUserPoolIntegrationTests: XCTestCase {
154154
}
155155
}
156156

157-
func signOut() async throws {
158-
try await Amplify.Auth.signOut()
157+
func signOut() async {
158+
_ = await Amplify.Auth.signOut()
159159
}
160160
}

AmplifyPlugins/Auth/Tests/AuthHostApp/AuthIntegrationTests/AWSAuthBaseTest.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class AWSAuthBaseTest: XCTestCase {
5656
let region = JSONValue(stringLiteral: "xx")
5757
let userPoolID = JSONValue(stringLiteral: "xx")
5858
let userPooldAppClientID = JSONValue(stringLiteral: "xx")
59-
let userPooldAppClientSecret = JSONValue(stringLiteral: "xx")
6059

6160
let identityPoolID = JSONValue(stringLiteral: "xx")
6261
do {

AmplifyPlugins/Auth/Tests/AuthHostApp/AuthStressTests/AuthStressBaseTest.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class AuthStressBaseTest: XCTestCase {
5656
let region = JSONValue(stringLiteral: "xx")
5757
let userPoolID = JSONValue(stringLiteral: "xx")
5858
let userPooldAppClientID = JSONValue(stringLiteral: "xx")
59-
let userPooldAppClientSecret = JSONValue(stringLiteral: "xx")
6059

6160
let identityPoolID = JSONValue(stringLiteral: "xx")
6261
do {

AmplifyPlugins/DataStore/Tests/AWSDataStorePluginTests/Sync/MutationQueue/ProcessMutationErrorFromCloudOperationTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ class ProcessMutationErrorFromCloudOperationTests: XCTestCase {
310310
}
311311

312312
func testProcessMutationErrorFromCloudOperationSuccessForUnauthorized() throws {
313-
let remotePost = Post(id: localPost.id, title: "remoteTitle", content: "remoteContent", createdAt: .now())
314313
let mutationEvent = try MutationEvent(model: localPost, modelSchema: localPost.schema, mutationType: .delete)
315314
let graphQLResponseError = GraphQLResponseError<MutationSync<AnyModel>>.error([graphQLError(.unauthorized)])
316315
let expectCompletion = expectation(description: "Expect to complete error processing")

AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginAuthCognitoTests/AWSDataStoreAuthBaseTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ extension AWSDataStoreAuthBaseTest {
217217
func signOut(file: StaticString = #file,
218218
line: UInt = #line) async throws {
219219
do {
220-
_ = try await Amplify.Auth.signOut()
220+
_ = await Amplify.Auth.signOut()
221221
print("signOut successfull")
222222
let isSignedIn = try await isSignedIn()
223223
XCTAssertFalse(isSignedIn)

AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginAuthIAMTests/AWSDataStoreAuthBaseTest.swift

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,9 @@ extension AWSDataStoreAuthBaseTest {
225225
func signOut(file: StaticString = #file,
226226
line: UInt = #line) async {
227227
let signoutInvoked = AsyncExpectation(description: "sign out completed")
228-
do {
229-
_ = try await Amplify.Auth.signOut()
230-
Task {
231-
await signoutInvoked.fulfill()
232-
}
233-
} catch(let error) {
234-
XCTFail("Signout failure \(error)", file: file, line: line)
235-
Task {
236-
await signoutInvoked.fulfill() // won't count as pass
237-
}
228+
Task {
229+
_ = await Amplify.Auth.signOut()
230+
await signoutInvoked.fulfill()
238231
}
239232

240233
await waitForExpectations([signoutInvoked], timeout: TestCommonConstants.networkTimeout)

AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginIntegrationTests/Connection/DataStoreConnectionScenario5Tests.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class DataStoreConnectionScenario5Tests: SyncEngineIntegrationTestBase {
6969
try await startAmplifyAndWaitForSync()
7070
let post = try await savePost(title: "title")
7171
let user = try await saveUser(username: "username")
72-
try await savePostEditor(post: post, editor: user)
72+
_ = try await savePostEditor(post: post, editor: user)
7373
let predicateByUserId = PostEditor5.keys.editor.eq(user.id)
7474
_ = try await Amplify.DataStore.query(PostEditor5.self, where: predicateByUserId)
7575
}
@@ -79,7 +79,7 @@ class DataStoreConnectionScenario5Tests: SyncEngineIntegrationTestBase {
7979
try await startAmplifyAndWaitForSync()
8080
let post = try await savePost(title: "title")
8181
let user = try await saveUser(username: "username")
82-
let postEditor = try await savePostEditor(post: post, editor: user)
82+
_ = try await savePostEditor(post: post, editor: user)
8383

8484
let queriedPostOptional = try await Amplify.DataStore.query(Post5.self, byId: post.id)
8585
guard let queriedPost = queriedPostOptional else {
@@ -100,7 +100,7 @@ class DataStoreConnectionScenario5Tests: SyncEngineIntegrationTestBase {
100100
try await startAmplifyAndWaitForSync()
101101
let post = try await savePost(title: "title")
102102
let user = try await saveUser(username: "username")
103-
let postEditor = try await savePostEditor(post: post, editor: user)
103+
_ = try await savePostEditor(post: post, editor: user)
104104

105105
let queriedUserOptional = try await Amplify.DataStore.query(User5.self, byId: user.id)
106106
guard let queriedUser = queriedUserOptional else {
@@ -123,7 +123,6 @@ class DataStoreConnectionScenario5Tests: SyncEngineIntegrationTestBase {
123123

124124
func saveUser(id: String = UUID().uuidString, username: String) async throws -> User5 {
125125
let user = User5(id: id, username: username)
126-
var result: User5?
127126
return try await Amplify.DataStore.save(user)
128127
}
129128

AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginMultiAuthTests/AWSDataStoreAuthBaseTest.swift

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,16 +225,9 @@ extension AWSDataStoreAuthBaseTest {
225225
func signOut(file: StaticString = #file,
226226
line: UInt = #line) async {
227227
let signoutInvoked = AsyncExpectation(description: "sign out completed")
228-
do {
229-
_ = try await Amplify.Auth.signOut()
230-
Task {
231-
await signoutInvoked.fulfill()
232-
}
233-
} catch(let error) {
234-
XCTFail("Signout failure \(error)", file: file, line: line)
235-
Task {
236-
await signoutInvoked.fulfill() // won't count as pass
237-
}
228+
Task {
229+
_ = await Amplify.Auth.signOut()
230+
await signoutInvoked.fulfill()
238231
}
239232

240233
await waitForExpectations([signoutInvoked], timeout: TestCommonConstants.networkTimeout)

0 commit comments

Comments
 (0)