40 lines
1.2 KiB
Swift
40 lines
1.2 KiB
Swift
//
|
|
// Copyright Amazon.com Inc. or its affiliates.
|
|
// All Rights Reserved.
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
import XCTest
|
|
@testable import AWSCognitoAuthPlugin
|
|
|
|
class AuthStateConfiguringAuthentication: XCTestCase {
|
|
var resolver: AnyResolver<AuthState> {
|
|
AuthState.Resolver().logging().eraseToAnyResolver()
|
|
}
|
|
|
|
let oldState = AuthState.configuringAuthentication(.notConfigured)
|
|
|
|
func testAuthenticationConfiguredReceived() {
|
|
let expected = AuthState.configuringAuthorization(.notConfigured, .notConfigured)
|
|
let resolution = resolver.resolve(oldState: oldState, byApplying: AuthEvent.authenticationConfigured)
|
|
XCTAssertEqual(resolution.newState, expected)
|
|
}
|
|
|
|
func testUnSupported() {
|
|
func assertIfUnsupported(_ event: AuthEvent) {
|
|
switch event.eventType {
|
|
case .authenticationConfigured:
|
|
// Supported
|
|
break
|
|
default:
|
|
let resolution = resolver.resolve(oldState: oldState, byApplying: event)
|
|
XCTAssertEqual(resolution.newState, oldState)
|
|
}
|
|
}
|
|
|
|
AuthEvent.allEvents.forEach(assertIfUnsupported(_:))
|
|
}
|
|
|
|
}
|