@@ -706,15 +706,13 @@ class AuthTests: XCTestCase {
706
706
let condition1 = expectation ( description: " auth handler didn't get called " )
707
707
708
708
let localStorage = MockLocalStorage ( )
709
-
710
709
localStorage. email = AuthTests . email
711
710
712
- let config = IterableConfig ( )
713
-
714
711
let authDelegate = createAuthDelegate ( { handler in
715
712
condition1. fulfill ( )
716
713
} )
717
714
715
+ let config = IterableConfig ( )
718
716
config. authDelegate = authDelegate
719
717
720
718
let internalAPI = IterableAPIInternal . initializeForTesting ( config: config,
@@ -728,6 +726,31 @@ class AuthTests: XCTestCase {
728
726
wait ( for: [ condition1] , timeout: testExpectationTimeout)
729
727
}
730
728
729
+ func testLoggedOutAuthTokenRequest( ) {
730
+ let condition1 = expectation ( description: " auth handler was called " )
731
+ condition1. isInverted = true
732
+
733
+ let localStorage = MockLocalStorage ( )
734
+ localStorage. email = AuthTests . email
735
+
736
+ let authDelegate = createAuthDelegate ( { handler in
737
+ condition1. fulfill ( )
738
+ } )
739
+
740
+ let config = IterableConfig ( )
741
+ config. authDelegate = authDelegate
742
+
743
+ let internalAPI = IterableAPIInternal . initializeForTesting ( config: config,
744
+ localStorage: localStorage)
745
+
746
+ XCTAssertNotNil ( internalAPI. email)
747
+ XCTAssertNil ( internalAPI. authManager. getAuthToken ( ) )
748
+
749
+ internalAPI. logoutUser ( )
750
+
751
+ wait ( for: [ condition1] , timeout: testExpectationTimeoutForInverted)
752
+ }
753
+
731
754
// MARK: - Private
732
755
733
756
class DefaultAuthDelegate : IterableAuthDelegate {
0 commit comments