refactor(android): add shared albumCoverPath cover-URL builder

This commit is contained in:
2026-05-29 14:39:31 -04:00
parent 4015fb145d
commit 0741ba31b3
2 changed files with 27 additions and 0 deletions
@@ -0,0 +1,11 @@
package com.fabledsword.minstrel.models
/**
* Absolute cover URL for an album, or "" when [albumId] is blank. Uses
* the placeholder host that `BaseUrlInterceptor` rewrites to the live
* server (carrying the auth cookie); `ServerImage` passes it through,
* and the raw-AsyncImage cover surfaces still load it. The single
* album-cover URL builder for the whole client.
*/
fun albumCoverPath(albumId: String): String =
if (albumId.isEmpty()) "" else "http://placeholder.invalid/api/albums/$albumId/cover"
@@ -0,0 +1,16 @@
package com.fabledsword.minstrel.models
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
class CoverUrlsTest {
@Test
fun `albumCoverPath builds the placeholder cover URL`() {
assertEquals("http://placeholder.invalid/api/albums/a1/cover", albumCoverPath("a1"))
}
@Test
fun `albumCoverPath is empty for a blank id`() {
assertEquals("", albumCoverPath(""))
}
}