package com.cottondb.account import org.junit.Assert.assertTrue import org.junit.Test import java.io.File /** * DELETE EVERYWHERE (owner, 25 Nov 2026: every app has a way to ask for deletion, and we delete in 30 days): every app * on Android reaches the shell's one Delete account page, signed in only, the same flow Words has. */ class DeleteEverywhereTest { private val repo = generateSequence(File("").absoluteFile) { it.parentFile }.first { File(it, "apps/registry.json").isFile } private fun src(path: String) = File(repo, "apps/android/$path").readText() /** The shell's Settings draws Delete account in its delete slot, signed in only: Words, Days, Story, Sites and Data come through it. */ @Test fun the_shells_settings_carry_delete_account_signed_in() { val home = src("shell/src/main/kotlin/com/cottondb/shell/SettingsHome.kt") assertTrue(home.contains("DeleteAccountPart(shell, onDeleted = onDeleted)")) assertTrue(home.contains("if (who.signedIn) slots.delete()")) listOf("notes/kotlin/com/cottondb/notes/NotesSettings.kt", "days/kotlin/com/cottondb/days/ui/Settings.kt", "story/kotlin/com/cottondb/story/ink/Pages.kt", "sites/kotlin/com/cottondb/sites/You.kt", "data/kotlin/com/cottondb/data/You.kt") .forEach { assertTrue(it, src("app/src/$it").contains("SettingsHome(")) } } /** Apps with their own You draw the shell's part themselves: Comms, Secrets, Post. */ @Test fun own_you_pages_draw_the_shells_part() { listOf("messages/kotlin/com/cottondb/messages/warm/ChatRoot.kt", "keys/kotlin/com/cottondb/keys/secrets/Places.kt", "mail/kotlin/com/cottondb/mail/SharedPages.kt") .forEach { assertTrue(it, src("app/src/$it").contains("DeleteAccountPart(")) } } /** * Secrets is signed in when the shell says so (signed in through another app's one tap, the vault's account offered * no acts and You stood signed out with no Delete account); signed out with no act of the vault's, Sign in is the * shell's (the card did nothing). */ @Test fun secrets_reads_signed_in_from_the_shell_too() { val places = src("app/src/keys/kotlin/com/cottondb/keys/secrets/Places.kt") assertTrue(places.contains("vaultSignedIn || who.signedIn")) assertTrue(places.contains("\"account_sign_in\"")) assertTrue(places.contains("SHELL_SYNC_ACTS")) } /** Post's Sync page follows the copy (shell.home): signed in there, it shows Sync now, Sign out and Delete account at once. */ @Test fun posts_sync_page_follows_the_copy() { val shared = src("app/src/mail/kotlin/com/cottondb/mail/SharedPages.kt") assertTrue(shared.contains("remember(home) { shell.session.held() != null }")) assertTrue(shared.contains("rememberSyncSeen(shell)")) } }