Skip to content

Commit

Permalink
update pinpoint unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh62 committed Feb 15, 2024
1 parent 9001d26 commit 0f804d8
Showing 1 changed file with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
//

@testable import Amplify
import AWSClientRuntime
import AwsCommonRuntimeKit
import AWSPinpoint
@testable import AWSPinpointPushNotificationsPlugin
import ClientRuntime
import Foundation
import XCTest

Expand Down Expand Up @@ -72,12 +69,19 @@ class ErrorPushNotificationsTests: XCTestCase {
}
}
}
}

#if canImport(AWSClientRuntime)
import AWSClientRuntime

extension ErrorPushNotificationsTests {

/// Given: An UnknownAWSHTTPServiceError
/// When: pushNotificationsError is invoked
/// Then: A .unknown error is returned
func testPushNotificationError_withUnknownAWSHTTPServiceError_shouldReturnUnknownError() {
let error = UnknownAWSHTTPServiceError(httpResponse: .init(body: .none, statusCode: .accepted), message: "UnknownAWSHTTPServiceError", requestID: nil, typeName: nil)
let error = UnknownAWSHTTPServiceError(
httpResponse: .init(body: .empty, statusCode: .accepted), message: "UnknownAWSHTTPServiceError", requestID: nil, typeName: nil)
let pushNotificationsError = error.pushNotificationsError
switch pushNotificationsError {
case .unknown(let errorDescription, let underlyingError):
Expand All @@ -87,6 +91,14 @@ class ErrorPushNotificationsTests: XCTestCase {
XCTFail("Expected error of type .unknown, got \(pushNotificationsError)")
}
}
}

#endif

#if canImport(AwsCommonRuntimeKit)
import AwsCommonRuntimeKit

extension ErrorPushNotificationsTests {

/// Given: A CommonRunTimeError.crtError
/// When: pushNotificationsError is invoked
Expand All @@ -103,3 +115,5 @@ class ErrorPushNotificationsTests: XCTestCase {
}
}
}

#endif

0 comments on commit 0f804d8

Please sign in to comment.