feat: mark search results that are already in the target mood
CI / chart (push) Successful in 4s
CI / test (push) Successful in 2m19s
CI / chart-push (push) Successful in 5s
CI / image (push) Failing after 6m4s

This commit is contained in:
TapTap committed 2026-11-15 21:46:57 +00:00
1 parent 0613b8aedc
commit 0caeecb325
3 files changed
+13 -2

No files matched your search

@@ -292,9 +292,11 @@ class ApiRoutesTest {
testApplication {
setupApp(seed, search = FakeYt(results))
val token = client.token("alice", "alice-pw")
val moodId = client.createMood(token, """{"name":"Search Mood","recommendationCount":0}""")
client.addSong(token, moodId, seed.ambient1)
val body = parse(
client.get("/api/v1/search?q=ambient") { bearer(token) }.bodyAsText(),
client.get("/api/v1/search?q=ambient&moodId=$moodId") { bearer(token) }.bodyAsText(),
)
val found = body["results"]!!.jsonArray.map { it.jsonObject }
assertEquals(2, found.size)
@@ -303,6 +305,7 @@ class ApiRoutesTest {
val downloaded = found.first { it.string("videoId") == "vid-ambient-1" }
assertTrue(downloaded["downloaded"]!!.jsonPrimitive.content.toBoolean())
assertTrue(downloaded["inMood"]!!.jsonPrimitive.content.toBoolean())
assertEquals(seed.ambient1, downloaded.string("songId"))
assertFalse(
found.first { it.string("videoId") == "vid-new" }["downloaded"]!!