feat: mark search results that are already in the target mood
This commit is contained in:
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"]!!
|
||||
|
||||
Reference in new issue
Block a user