Skip to content

Commit

Permalink
worked on review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh62 committed Jul 4, 2024
1 parent d1f6041 commit 25d6664
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ extension HostedUIError: AuthErrorConvertible {
AuthPluginErrorConstants.hostedUITokenURI.recoverySuggestion)

case .signOutURI:
return .service(
return .configuration(
AuthPluginErrorConstants.hostedUISignOutURI.errorDescription,
AuthPluginErrorConstants.hostedUISignOutURI.recoverySuggestion)

case .signOutRedirectURI:
return .service(
return .configuration(
AuthPluginErrorConstants.hostedUISignOutRedirectURI.errorDescription,
AuthPluginErrorConstants.hostedUISignOutRedirectURI.recoverySuggestion)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,21 +142,19 @@ class ShowHostedUISignOutTests: XCTestCase {
await action.execute(
withDispatcher: MockDispatcher { event in
guard let event = event as? SignOutEvent,
case .signOutGlobally(let data, let hostedUIError) = event.eventType else {
case .hostedUISignOutError(let hostedUIError) = event.eventType else {
XCTFail("Expected SignOutEvent.signOutGlobally, got \(event)")
expectation.fulfill()
return
}

guard let hostedUIError = hostedUIError,
case .configuration(let errorDescription, _, let serviceError) = hostedUIError.error else {
guard case .configuration(let errorDescription, _, let serviceError) = hostedUIError.authError else {
XCTFail("Expected AuthError.configuration")
expectation.fulfill()
return
}

XCTAssertEqual(errorDescription, "Could not create logout URL")
XCTAssertEqual(data, signInData)
XCTAssertEqual(errorDescription, "SignOut URI could not be created")
XCTAssertNil(serviceError)
expectation.fulfill()
},
Expand Down Expand Up @@ -227,21 +225,19 @@ class ShowHostedUISignOutTests: XCTestCase {
await action.execute(
withDispatcher: MockDispatcher { event in
guard let event = event as? SignOutEvent,
case .signOutGlobally(let data, let hostedUIError) = event.eventType else {
case .hostedUISignOutError(let hostedUIError) = event.eventType else {
XCTFail("Expected SignOutEvent.signOutGlobally, got \(event)")
expectation.fulfill()
return
}

guard let hostedUIError = hostedUIError,
case .configuration(let errorDescription, _, let serviceError) = hostedUIError.error else {
guard case .configuration(let errorDescription, _, let serviceError) = hostedUIError.authError else {
XCTFail("Expected AuthError.configuration")
expectation.fulfill()
return
}

XCTAssertEqual(errorDescription, "Callback URL could not be retrieved")
XCTAssertEqual(data, signInData)
XCTAssertNil(serviceError)
expectation.fulfill()
},
Expand All @@ -267,20 +263,18 @@ class ShowHostedUISignOutTests: XCTestCase {
await action.execute(
withDispatcher: MockDispatcher { event in
guard let event = event as? SignOutEvent,
case .signOutGlobally(let data, let hostedUIError) = event.eventType else {
case .hostedUISignOutError(let hostedUIError) = event.eventType else {
XCTFail("Expected SignOutEvent.signOutGlobally, got \(event)")
expectation.fulfill()
return
}

guard let hostedUIError = hostedUIError,
case .configuration(let errorDescription, _, let serviceError) = hostedUIError.error else {
guard case .configuration(let errorDescription, _, let serviceError) = hostedUIError.authError else {
XCTFail("Expected AuthError.configuration")
expectation.fulfill()
return
}

XCTAssertEqual(data, signInData)
XCTAssertEqual(errorDescription, AuthPluginErrorConstants.configurationError)
XCTAssertNil(serviceError)
expectation.fulfill()
Expand All @@ -307,20 +301,18 @@ class ShowHostedUISignOutTests: XCTestCase {
await action.execute(
withDispatcher: MockDispatcher { event in
guard let event = event as? SignOutEvent,
case .signOutGlobally(let data, let hostedUIError) = event.eventType else {
case .hostedUISignOutError(let hostedUIError) = event.eventType else {
XCTFail("Expected SignOutEvent.signOutGlobally, got \(event)")
expectation.fulfill()
return
}

guard let hostedUIError = hostedUIError,
case .configuration(let errorDescription, _, let serviceError) = hostedUIError.error else {
guard case .configuration(let errorDescription, _, let serviceError) = hostedUIError.authError else {
XCTFail("Expected AuthError.configuration")
expectation.fulfill()
return
}

XCTAssertEqual(data, signInData)
XCTAssertEqual(errorDescription, AuthPluginErrorConstants.configurationError)
XCTAssertNil(serviceError)
expectation.fulfill()
Expand Down

0 comments on commit 25d6664

Please sign in to comment.