@@ -234,6 +234,18 @@ class PubkyRepoTest : BaseUnitTest() {
234234 verify(diskCache).remove(" pubky://image_uri" )
235235 }
236236
237+ @Test
238+ fun `deleteProfile should fail when signOut fails` () = test {
239+ authenticateForTesting()
240+ whenever(keychain.loadString(Keychain .Key .PAYKIT_SESSION .name)).thenReturn(" test_secret" )
241+ whenever(pubkyService.signOut()).thenThrow(RuntimeException (" Sign out failed" ))
242+ whenever(pubkyService.forceSignOut()).thenThrow(RuntimeException (" Force sign out failed" ))
243+
244+ val result = sut.deleteProfile()
245+
246+ assertTrue(result.isFailure)
247+ }
248+
237249 @Test
238250 fun `signOut should force sign out when server sign out fails` () = test {
239251 authenticateForTesting()
@@ -547,12 +559,12 @@ class PubkyRepoTest : BaseUnitTest() {
547559 secret : String = "test_secret",
548560 profileName : String = "Test ",
549561 ) {
550- whenever( pubkyService.completeAuth()) .thenReturn(secret)
551- whenever( pubkyService.importSession(secret)) .thenReturn(publicKey)
562+ whenever { pubkyService.completeAuth() } .thenReturn(secret)
563+ whenever { pubkyService.importSession(secret) } .thenReturn(publicKey)
552564 val ffiProfile = createFfiProfile(name = profileName)
553- whenever( pubkyService.getProfile(publicKey)) .thenReturn(ffiProfile)
565+ whenever { pubkyService.getProfile(publicKey) } .thenReturn(ffiProfile)
554566 whenever(keychain.loadString(Keychain .Key .PAYKIT_SESSION .name)).thenReturn(secret)
555- whenever( pubkyService.sessionList(secret, Env .contactsBasePath)) .thenReturn(emptyList())
567+ whenever { pubkyService.sessionList(secret, Env .contactsBasePath) } .thenReturn(emptyList())
556568
557569 sut.completeAuthentication()
558570 }
0 commit comments