Modern Apps git

← Modern-Apps.git

notes: fix stale backup-agent test after note images joined backups

Commit
549a7cc3ba4f12cbee724d80c107431b9fac8ebf
Author
Vayun Mathur <[email protected]>
When
2026-11-08 02:23 UTC (28 days ago)
Parents
49b63a8
The images-in-backups change made AppBackupAgent.extraFiles always return
the note_images dir (an image-less restore renders every image blank), but
backupAgentProperties still asserted extraFiles was empty, so it failed
red at HEAD.

The test now exercises the agent's delegates directly and asserts
extraFiles equals NoteImageStore.backupFiles, following the file's own
noteDbConfigs delegate pattern (a bare agent has no base context, so
direct delegation is the only way to cover it).

Verified: full :notes:testDevUnitTest suite green (153 tests, 0 failures).

Diff

notes/src/test/java/com/vayunmathur/notes/IntentsAndRouteTest.kt
diff --git a/notes/src/test/java/com/vayunmathur/notes/IntentsAndRouteTest.kt b/notes/src/test/java/com/vayunmathur/notes/IntentsAndRouteTest.ktindex b63e37c7fc..5d538823c1 100644--- a/notes/src/test/java/com/vayunmathur/notes/IntentsAndRouteTest.kt+++ b/notes/src/test/java/com/vayunmathur/notes/IntentsAndRouteTest.kt@@ -94,7 +94,15 @@ class IntentsAndRouteTest {     @Test fun backupAgentProperties() {         val agent = com.vayunmathur.notes.platform.AppBackupAgent()         assertNotNull(agent.dbCodec)-        assertEquals(emptyList(), agent.extraFiles)+        // The agent getters use the agent itself as the Context, and an+        // unattached agent has no base context, so exercise the delegates+        // directly with the app context: the note_images dir must travel+        // with the database backup, or a restore renders embedded images+        // blank.+        assertEquals(+            listOf(java.io.File(context.filesDir, "note_images").absolutePath),+            com.vayunmathur.notes.platform.NoteImageStore.backupFiles(context).map { it.absolutePath },+        )         FakeAndroidKeyStore.install()         runCatching { com.vayunmathur.library.util.DatabaseHelper(context).storePassphrase("test-passphrase") }         // AppBackupAgent.dbConfigs delegates to noteDbConfigs with the agent as