fix: align search test and available-films error handling
Agent-Logs-Url: https://github.com/devitq/movienight-backend/sessions/42b7a686-07a7-41f5-baf7-737b968e12cf Co-authored-by: devitq <118541411+devitq@users.noreply.github.com>
This commit is contained in:
co-authored by
devitq
parent
47ff6d80bf
commit
22025326e7
@@ -110,13 +110,11 @@ class FilmLibraryController(
|
|||||||
getFilmLibraryUseCase.getLibrary(
|
getFilmLibraryUseCase.getLibrary(
|
||||||
GetFilmLibraryQuery(userId = userId),
|
GetFilmLibraryQuery(userId = userId),
|
||||||
)
|
)
|
||||||
}.getOrElse { exception ->
|
}.onFailure { exception ->
|
||||||
if (exception is EntityNotFoundException) {
|
if (exception !is EntityNotFoundException) {
|
||||||
null
|
|
||||||
} else {
|
|
||||||
throw exception
|
throw exception
|
||||||
}
|
}
|
||||||
}
|
}.getOrNull()
|
||||||
|
|
||||||
val allFilms = getAllFilmsUseCase.getAll()
|
val allFilms = getAllFilmsUseCase.getAll()
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class FilmControllerSearchTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `search returns empty body when title is missing`() {
|
fun `search returns 404 when title is not found`() {
|
||||||
val title = "Unknown Title"
|
val title = "Unknown Title"
|
||||||
|
|
||||||
every { searchFilmByTitleUseCase.searchByTitle(title) } returns null
|
every { searchFilmByTitleUseCase.searchByTitle(title) } returns null
|
||||||
@@ -68,7 +68,7 @@ class FilmControllerSearchTest {
|
|||||||
.get("/api/films/search") {
|
.get("/api/films/search") {
|
||||||
param("title", title)
|
param("title", title)
|
||||||
}.andExpect {
|
}.andExpect {
|
||||||
status { isOk() }
|
status { isNotFound() }
|
||||||
content { string("") }
|
content { string("") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user