@@ -706,15 +706,13 @@ class AuthTests: XCTestCase {
706706 let condition1 = expectation ( description: " auth handler didn't get called " )
707707
708708 let localStorage = MockLocalStorage ( )
709-
710709 localStorage. email = AuthTests . email
711710
712- let config = IterableConfig ( )
713-
714711 let authDelegate = createAuthDelegate ( { handler in
715712 condition1. fulfill ( )
716713 } )
717714
715+ let config = IterableConfig ( )
718716 config. authDelegate = authDelegate
719717
720718 let internalAPI = IterableAPIInternal . initializeForTesting ( config: config,
@@ -728,6 +726,31 @@ class AuthTests: XCTestCase {
728726 wait ( for: [ condition1] , timeout: testExpectationTimeout)
729727 }
730728
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+
731754 // MARK: - Private
732755
733756 class DefaultAuthDelegate : IterableAuthDelegate {
0 commit comments