Skip to content

Commit b24c552

Browse files
committed
fix: address claude review notes
1 parent f43c091 commit b24c552

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

app/src/main/java/to/bitkit/repositories/PubkyRepo.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ class PubkyRepo @Inject constructor(
383383
}
384384
pubkyService.sessionDelete(session, Env.profilePath)
385385
}
386-
signOut()
386+
signOut().getOrThrow()
387387
}
388388

389389
@Suppress("LongParameterList")

app/src/main/java/to/bitkit/ui/ContentView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ fun ContentView(
527527
hasSeenProfileIntro = hasSeenProfileIntro,
528528
hasSeenContactsIntro = hasSeenContactsIntro,
529529
isProfileAuthenticated = isProfileAuthenticated,
530-
modifier = Modifier.align(Alignment.TopEnd),
530+
modifier = Modifier.align(Alignment.TopEnd)
531531
)
532532
}
533533
}

app/src/test/java/to/bitkit/repositories/PubkyRepoTest.kt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)