feat: comic metadata picker, lazy-load providers, and UI improvements (#2679)
* feat: add comic metadata support to metadata picker and fix Comicvine parser * feat: lazy-load Comicvine issue details on selection * feat: lazy-load detail metadata for Amazon, GoodReads, and Audible parsers * fix: prevent spurious comic_metadata row creation for non-comic books * fix: extract rich previews from Audible search and reorder picker sections * feat: redesign metadata editor layout with collapsible sections and boolean selects * fix: implement per-field comic metadata locks replacing grouped locks * feat: add comic metadata filters and fix visibleFilters backend support * fix: use human-readable role labels in comic creator filter * fix: auto-populate comic metadata from ComicVine during metadata fetch * refactor: clean up ComicvineBookParser remove duplication and comments * fix: use ComicMetadata webLink for ComicVine favicon URL * fix: cache library options to prevent Set All dropdowns from resetting * fix: stream book content from disk instead of loading entire file into memory * fix: increase max visible filters from 15 to 20 * feat: replace filter multiselect with drag-and-drop reorderable list * fix: use audiobook-specific cover paths and cache busting for audiobook thumbnail updates * chore: enforce mandatory screenshots and stricter testing requirements in PR template * fix: update BookServiceTest to match Resource return type after streaming change --------- Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
@@ -21,7 +21,6 @@ import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockedStatic;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.core.io.ByteArrayResource;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.UrlResource;
|
||||
@@ -318,7 +317,7 @@ class BookServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void getBookContent_returnsByteArrayResource() throws Exception {
|
||||
void getBookContent_returnsResource() throws Exception {
|
||||
BookEntity entity = new BookEntity();
|
||||
entity.setId(10L);
|
||||
when(bookRepository.findById(10L)).thenReturn(Optional.of(entity));
|
||||
@@ -326,9 +325,9 @@ class BookServiceTest {
|
||||
Files.write(path, "hello".getBytes());
|
||||
try (MockedStatic<FileUtils> fileUtilsMock = mockStatic(FileUtils.class)) {
|
||||
fileUtilsMock.when(() -> FileUtils.getBookFullPath(entity)).thenReturn(path.toString());
|
||||
ResponseEntity<ByteArrayResource> response = bookService.getBookContent(10L);
|
||||
ResponseEntity<Resource> response = bookService.getBookContent(10L);
|
||||
assertEquals(HttpStatus.OK, response.getStatusCode());
|
||||
assertArrayEquals("hello".getBytes(), response.getBody().getByteArray());
|
||||
assertArrayEquals("hello".getBytes(), response.getBody().getInputStream().readAllBytes());
|
||||
} finally {
|
||||
Files.deleteIfExists(path);
|
||||
}
|
||||
@@ -341,13 +340,13 @@ class BookServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void getBookContent_fileIoError_throwsIOException() throws Exception {
|
||||
void getBookContent_fileNotFound_throwsException() {
|
||||
BookEntity entity = new BookEntity();
|
||||
entity.setId(12L);
|
||||
when(bookRepository.findById(12L)).thenReturn(Optional.of(entity));
|
||||
try (MockedStatic<FileUtils> fileUtilsMock = mockStatic(FileUtils.class)) {
|
||||
fileUtilsMock.when(() -> FileUtils.getBookFullPath(entity)).thenReturn("/tmp/nonexistentfile.txt");
|
||||
assertThrows(java.io.FileNotFoundException.class, () -> bookService.getBookContent(12L));
|
||||
assertThrows(APIException.class, () -> bookService.getBookContent(12L));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user