File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -213,6 +213,7 @@ extension Auth {
213213 let statusCode = ( response as? HTTPURLResponse ) ? . statusCode
214214
215215 guard let statusCode, ( 200 ..< 300 ) . contains ( statusCode) else {
216+ await saveCredentials ( nil )
216217 throw Error . response ( statusCode: statusCode, data: responseData)
217218 }
218219
Original file line number Diff line number Diff line change @@ -392,6 +392,7 @@ final class AuthTests: XCTestCase {
392392 var keychain = Keychain . unimplemented ( )
393393 keychain. loadCredentials = { await credentials. value }
394394 keychain. saveCredentials = { await credentials. setValue ( $0) }
395+ keychain. deleteCredentials = { await credentials. setValue ( nil ) }
395396 return keychain
396397 } ( ) ,
397398 httpClient: . init { _ in
@@ -423,6 +424,9 @@ final class AuthTests: XCTestCase {
423424 " Expected to throw response error, got \( error) "
424425 )
425426 }
427+ await credentials. withValue {
428+ XCTAssertNil ( $0)
429+ }
426430 }
427431
428432 func testSignOut( ) async {
You can’t perform that action at this time.
0 commit comments