diff --git a/Test/Tests/AuthTests.swift b/Test/Tests/AuthTests.swift index 7e89ecb47..ba62b7177 100644 --- a/Test/Tests/AuthTests.swift +++ b/Test/Tests/AuthTests.swift @@ -464,9 +464,7 @@ class AuthTests: XCTestCase { guard let error = error else { fail("Error is nil"); done(); return } - XCTAssertEqual(error.code, Int(ARTState.requestTokenFailed.rawValue)) - expect(error.message).to(contain("no means to renew the token is provided")) - + XCTAssertEqual(error.code, Int(ARTState.requestTokenFailed.rawValue)) // no means to renew the token is provided XCTAssertEqual(proxyHTTPExecutor.requests.count, 0) done() } @@ -505,8 +503,7 @@ class AuthTests: XCTestCase { guard let error = error else { fail("Error is nil"); done(); return } - XCTAssertEqual(error.code, Int(ARTState.requestTokenFailed.rawValue)) - expect(error.message).to(contain("no means to renew the token is provided")) + XCTAssertEqual(error.code, Int(ARTState.requestTokenFailed.rawValue)) // no means to renew the token is provided XCTAssertEqual(proxyHTTPExecutor.requests.count, 1) XCTAssertEqual(proxyHTTPExecutor.responses.count, 1) guard let response = proxyHTTPExecutor.responses.first else { @@ -1914,7 +1911,7 @@ class AuthTests: XCTestCase { guard let error = error else { fail("Error is nil"); done(); return } - expect(error.message).to(contain("invalid clientId")) + XCTAssertTrue(error.code == ARTErrorCode.invalidClientId.rawValue) done() } } diff --git a/Test/Tests/PushAdminTests.swift b/Test/Tests/PushAdminTests.swift index aa0e3be8c..f05fe0a3a 100644 --- a/Test/Tests/PushAdminTests.swift +++ b/Test/Tests/PushAdminTests.swift @@ -279,7 +279,7 @@ class PushAdminTests: XCTestCase { fail("Error is missing"); done(); return } XCTAssertEqual(error.statusCode, 400) - expect(error.message).to(contain("recipient must contain")) + XCTAssertTrue(error.code == ARTErrorCode.badRequest.rawValue) // recipient must contain a 'deviceId', 'clientId', or 'transportType' done() } } @@ -368,7 +368,7 @@ class PushAdminTests: XCTestCase { fail("Error should not be empty"); done(); return } XCTAssertEqual(error.statusCode, 404) - expect(error.message).to(contain("not found")) + XCTAssertTrue(error.code == ARTErrorCode.notFound.rawValue) done() } } @@ -715,7 +715,7 @@ class PushAdminTests: XCTestCase { fail("Error is nil"); done(); return } XCTAssertEqual(error.statusCode, 400) - expect(error.message).to(contain("device madeup doesn't exist")) + XCTAssertTrue(error.code == ARTErrorCode.badRequest.rawValue) // registration for device madeup doesn't exist done() } } diff --git a/Test/Tests/RealtimeClientChannelTests.swift b/Test/Tests/RealtimeClientChannelTests.swift index 8eaa6bcd4..752278d35 100644 --- a/Test/Tests/RealtimeClientChannelTests.swift +++ b/Test/Tests/RealtimeClientChannelTests.swift @@ -1558,7 +1558,7 @@ class RealtimeClientChannelTests: XCTestCase { guard let error = error else { fail("Reason error is nil"); return } - expect(error.message).to(contain("timed out")) + XCTAssertTrue(error.code == ARTState.detachTimedOut.rawValue) XCTAssertEqual(channel.state, ARTRealtimeChannelState.attached) done() } @@ -1948,7 +1948,7 @@ class RealtimeClientChannelTests: XCTestCase { guard let error = error else { fail("Error is nil"); return } - expect(error.message).to(contain("timed out")) + XCTAssertTrue(error.code == ARTState.detachTimedOut.rawValue) XCTAssertEqual(error, channel.errorReason) callbackCalled = true } @@ -3959,7 +3959,7 @@ class RealtimeClientChannelTests: XCTestCase { guard let error = stateChange.reason else { fail("Reason error is nil"); done(); return } - expect(error.message).to(contain("timed out")) + XCTAssertTrue(error.code == ARTState.attachTimedOut.rawValue) XCTAssertTrue(channel.errorReason === error) done() } @@ -4186,7 +4186,7 @@ class RealtimeClientChannelTests: XCTestCase { guard let error = stateChange.reason else { fail("Reason error is nil"); done(); return } - expect(error.message).to(contain("timed out")) + XCTAssertTrue(error.code == ARTState.attachTimedOut.rawValue) XCTAssertTrue(channel.errorReason === error) done() } diff --git a/Test/Tests/RealtimeClientConnectionTests.swift b/Test/Tests/RealtimeClientConnectionTests.swift index 2304b6cf7..6793fa0fd 100644 --- a/Test/Tests/RealtimeClientConnectionTests.swift +++ b/Test/Tests/RealtimeClientConnectionTests.swift @@ -1936,7 +1936,7 @@ class RealtimeClientConnectionTests: XCTestCase { fail("expected error"); done(); return } let end = NSDate() - expect(error.message).to(contain("timed out")) + XCTAssertTrue(error.code == ARTErrorCode.connectionTimedOut.rawValue) expect(end.timeIntervalSince(start as Date)).to(beCloseTo(realtimeRequestTimeout, within: 1.5)) done() } @@ -2312,9 +2312,8 @@ class RealtimeClientConnectionTests: XCTestCase { options.authCallback = { _, _ in // Ignore `completion` closure to force a time out } - }, - checkError: { error in - XCTAssertTrue(error.message.contains("timed out")) + }, checkError: { error in + XCTAssertTrue(error.code == ARTErrorCode.authConfiguredProviderFailure.rawValue) // timed out }) } @@ -4104,7 +4103,7 @@ class RealtimeClientConnectionTests: XCTestCase { guard let error = stateChange.reason else { fail("Error is nil"); done(); return } - expect(error.message).to(contain("Invalid key")) + XCTAssertTrue(error.code == ARTErrorCode.invalidCredential.rawValue) done() } } diff --git a/Test/Tests/RealtimeClientPresenceTests.swift b/Test/Tests/RealtimeClientPresenceTests.swift index f58a0e1c8..dc2a545af 100644 --- a/Test/Tests/RealtimeClientPresenceTests.swift +++ b/Test/Tests/RealtimeClientPresenceTests.swift @@ -1922,7 +1922,7 @@ class RealtimeClientPresenceTests: XCTestCase { guard let error = error else { fail("error expected"); done(); return } - expect(error.message).to(contain("Channel denied access based on given capability")) + XCTAssertTrue(error.code == ARTErrorCode.operationNotPermittedWithProvidedCapability.rawValue) done() } } @@ -2002,7 +2002,7 @@ class RealtimeClientPresenceTests: XCTestCase { guard let error = error else { fail("Error is nil"); done(); return } - expect(error.message).to(contain("Channel denied access based on given capability")) + XCTAssertTrue(error.code == ARTErrorCode.operationNotPermittedWithProvidedCapability.rawValue) done() } } diff --git a/Test/Tests/RealtimeClientTests.swift b/Test/Tests/RealtimeClientTests.swift index e47d480a5..28d37383f 100644 --- a/Test/Tests/RealtimeClientTests.swift +++ b/Test/Tests/RealtimeClientTests.swift @@ -573,7 +573,7 @@ class RealtimeClientTests: XCTestCase { guard let error = stateChange.reason else { fail("Error is nil"); done(); return } - expect(error.message).to(contain("Channel denied access based on given capability")) + XCTAssertTrue(error.code == ARTErrorCode.operationNotPermittedWithProvidedCapability.rawValue) done() } channel.attach() diff --git a/Test/Tests/RestClientTests.swift b/Test/Tests/RestClientTests.swift index ce5f63e14..0b373cd36 100644 --- a/Test/Tests/RestClientTests.swift +++ b/Test/Tests/RestClientTests.swift @@ -1757,7 +1757,6 @@ class RestClientTests: XCTestCase { return } XCTAssertEqual(error.code, Int(ARTState.requestTokenFailed.rawValue)) - expect(error.message).to(contain("no means to renew the token is provided")) done() } } @@ -2053,7 +2052,6 @@ class RestClientTests: XCTestCase { } XCTAssertEqual(error.statusCode, 401) XCTAssertEqual(error.code, ARTErrorCode.errorFromClientTokenCallback.intValue) - expect(error.message).to(contain("Error in requesting auth token")) done() } }