test: align unit stubs and fixtures with the review-round changes
All checks were successful
CI / Unit & Component Tests (pull_request) Successful in 4m16s
CI / OCR Service Tests (pull_request) Successful in 23s
CI / Backend Unit Tests (pull_request) Successful in 4m17s
CI / fail2ban Regex (pull_request) Successful in 43s
CI / Semgrep Security Scan (pull_request) Successful in 23s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m5s
All checks were successful
CI / Unit & Component Tests (pull_request) Successful in 4m16s
CI / OCR Service Tests (pull_request) Successful in 23s
CI / Backend Unit Tests (pull_request) Successful in 4m17s
CI / fail2ban Regex (pull_request) Successful in 43s
CI / Semgrep Security Scan (pull_request) Successful in 23s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m5s
CI caught three spots the targeted local runs missed: the relevance-path unit tests still stubbed findAllById (the path now calls findByIdIn — the batchMetadata stubs legitimately keep findAllById), the second GeschichtenCard test file still expected the removed email fallback, and the AND/OR-toggle describe lacked the wait-for-slide-transition guard its sibling describe documents — the flake that failed run 2208. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -851,7 +851,7 @@ public class DocumentService {
|
|||||||
FtsPage ftsPage = toFtsPage(documentRepository.findFtsPageRaw(text, offset, limit));
|
FtsPage ftsPage = toFtsPage(documentRepository.findFtsPageRaw(text, offset, limit));
|
||||||
if (ftsPage.hits().isEmpty()) return DocumentSearchResult.of(List.of());
|
if (ftsPage.hits().isEmpty()) return DocumentSearchResult.of(List.of());
|
||||||
|
|
||||||
// Preserve ts_rank order from SQL across the JPA findAllById call.
|
// Preserve ts_rank order from SQL across the JPA findByIdIn call.
|
||||||
Map<UUID, Integer> rankMap = new HashMap<>();
|
Map<UUID, Integer> rankMap = new HashMap<>();
|
||||||
List<UUID> pageIds = new ArrayList<>();
|
List<UUID> pageIds = new ArrayList<>();
|
||||||
for (int i = 0; i < ftsPage.hits().size(); i++) {
|
for (int i = 0; i < ftsPage.hits().size(); i++) {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class DocumentServiceSortTest {
|
|||||||
UUID id1 = UUID.randomUUID();
|
UUID id1 = UUID.randomUUID();
|
||||||
List<Object[]> ftsRows = ftsRows(id1, 0.5d, 1L);
|
List<Object[]> ftsRows = ftsRows(id1, 0.5d, 1L);
|
||||||
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(ftsRows);
|
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(ftsRows);
|
||||||
when(documentRepository.findAllById(any()))
|
when(documentRepository.findByIdIn(any()))
|
||||||
.thenReturn(List.of(doc(id1)));
|
.thenReturn(List.of(doc(id1)));
|
||||||
|
|
||||||
documentService.searchDocuments(
|
documentService.searchDocuments(
|
||||||
@@ -101,7 +101,7 @@ class DocumentServiceSortTest {
|
|||||||
ftsRows.add(new Object[]{id1, 0.8d, 2L});
|
ftsRows.add(new Object[]{id1, 0.8d, 2L});
|
||||||
ftsRows.add(new Object[]{id2, 0.3d, 2L});
|
ftsRows.add(new Object[]{id2, 0.3d, 2L});
|
||||||
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(ftsRows);
|
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(ftsRows);
|
||||||
when(documentRepository.findAllById(any())).thenReturn(List.of(doc(id2), doc(id1))); // unordered from JPA
|
when(documentRepository.findByIdIn(any())).thenReturn(List.of(doc(id2), doc(id1))); // unordered from JPA
|
||||||
|
|
||||||
DocumentSearchResult result = documentService.searchDocuments(
|
DocumentSearchResult result = documentService.searchDocuments(
|
||||||
new SearchFilters("Brief", null, null, null, null, null, null, null, null, false),
|
new SearchFilters("Brief", null, null, null, null, null, null, null, null, false),
|
||||||
@@ -119,7 +119,7 @@ class DocumentServiceSortTest {
|
|||||||
ftsRows.add(new Object[]{id1, 0.8d, 2L});
|
ftsRows.add(new Object[]{id1, 0.8d, 2L});
|
||||||
ftsRows.add(new Object[]{id2, 0.3d, 2L});
|
ftsRows.add(new Object[]{id2, 0.3d, 2L});
|
||||||
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(ftsRows);
|
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(ftsRows);
|
||||||
when(documentRepository.findAllById(any())).thenReturn(List.of(doc(id2), doc(id1)));
|
when(documentRepository.findByIdIn(any())).thenReturn(List.of(doc(id2), doc(id1)));
|
||||||
|
|
||||||
DocumentSearchResult result = documentService.searchDocuments(
|
DocumentSearchResult result = documentService.searchDocuments(
|
||||||
new SearchFilters("Brief", null, null, null, null, null, null, null, null, false),
|
new SearchFilters("Brief", null, null, null, null, null, null, null, null, false),
|
||||||
@@ -153,7 +153,7 @@ class DocumentServiceSortTest {
|
|||||||
List<Object[]> ftsRows = new ArrayList<>();
|
List<Object[]> ftsRows = new ArrayList<>();
|
||||||
ftsRows.add(new Object[]{stringId, 0.5d, 1L});
|
ftsRows.add(new Object[]{stringId, 0.5d, 1L});
|
||||||
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(ftsRows);
|
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(ftsRows);
|
||||||
when(documentRepository.findAllById(any())).thenReturn(List.of(doc(uuidId)));
|
when(documentRepository.findByIdIn(any())).thenReturn(List.of(doc(uuidId)));
|
||||||
|
|
||||||
DocumentSearchResult result = documentService.searchDocuments(
|
DocumentSearchResult result = documentService.searchDocuments(
|
||||||
new SearchFilters("Brief", null, null, null, null, null, null, null, null, false),
|
new SearchFilters("Brief", null, null, null, null, null, null, null, null, false),
|
||||||
|
|||||||
@@ -2166,7 +2166,7 @@ class DocumentServiceTest {
|
|||||||
List<Object[]> ftsRows = new java.util.ArrayList<>();
|
List<Object[]> ftsRows = new java.util.ArrayList<>();
|
||||||
ftsRows.add(new Object[]{docId, 0.5d, 1L});
|
ftsRows.add(new Object[]{docId, 0.5d, 1L});
|
||||||
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(ftsRows);
|
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(ftsRows);
|
||||||
when(documentRepository.findAllById(any())).thenReturn(List.of(doc));
|
when(documentRepository.findByIdIn(any())).thenReturn(List.of(doc));
|
||||||
when(documentRepository.findEnrichmentData(any(), eq("Brief"))).thenReturn(rows);
|
when(documentRepository.findEnrichmentData(any(), eq("Brief"))).thenReturn(rows);
|
||||||
|
|
||||||
DocumentSearchResult result = documentService.searchDocuments(
|
DocumentSearchResult result = documentService.searchDocuments(
|
||||||
@@ -2202,7 +2202,7 @@ class DocumentServiceTest {
|
|||||||
List<Object[]> snippetFtsRows = new java.util.ArrayList<>();
|
List<Object[]> snippetFtsRows = new java.util.ArrayList<>();
|
||||||
snippetFtsRows.add(new Object[]{docId, 0.5d, 1L});
|
snippetFtsRows.add(new Object[]{docId, 0.5d, 1L});
|
||||||
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(snippetFtsRows);
|
when(documentRepository.findFtsPageRaw(anyString(), anyInt(), anyInt())).thenReturn(snippetFtsRows);
|
||||||
when(documentRepository.findAllById(any())).thenReturn(List.of(doc));
|
when(documentRepository.findByIdIn(any())).thenReturn(List.of(doc));
|
||||||
when(documentRepository.findEnrichmentData(any(), eq("Brief"))).thenReturn(rows);
|
when(documentRepository.findEnrichmentData(any(), eq("Brief"))).thenReturn(rows);
|
||||||
|
|
||||||
DocumentSearchResult result = documentService.searchDocuments(
|
DocumentSearchResult result = documentService.searchDocuments(
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ const makeGeschichte = (overrides: Record<string, unknown> = {}): GeschichteSumm
|
|||||||
type: 'STORY' as const,
|
type: 'STORY' as const,
|
||||||
publishedAt: '2026-04-15T10:00:00Z',
|
publishedAt: '2026-04-15T10:00:00Z',
|
||||||
author: {
|
author: {
|
||||||
email: 'a@b',
|
|
||||||
firstName: 'Anna',
|
firstName: 'Anna',
|
||||||
lastName: 'Schmidt'
|
lastName: 'Schmidt'
|
||||||
},
|
},
|
||||||
@@ -103,17 +102,17 @@ describe('GeschichtenCard', () => {
|
|||||||
await expect.element(page.getByText(/Anna Schmidt/)).toBeVisible();
|
await expect.element(page.getByText(/Anna Schmidt/)).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('falls back to author email when no name', async () => {
|
it('falls back to [Unbekannt] when no name', async () => {
|
||||||
render(GeschichtenCard, {
|
render(GeschichtenCard, {
|
||||||
props: baseProps({
|
props: baseProps({
|
||||||
geschichten: [
|
geschichten: [
|
||||||
makeGeschichte({
|
makeGeschichte({
|
||||||
author: { firstName: undefined, lastName: undefined, email: 'fallback@x' }
|
author: { firstName: undefined, lastName: undefined }
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
await expect.element(page.getByText(/fallback@x/)).toBeVisible();
|
await expect.element(page.getByText('[Unbekannt]')).toBeVisible();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ describe('SearchFilterBar – AND/OR tag operator toggle', () => {
|
|||||||
async function openAdvanced() {
|
async function openAdvanced() {
|
||||||
const filterBtn = page.getByRole('button', { name: 'Filter', exact: true });
|
const filterBtn = page.getByRole('button', { name: 'Filter', exact: true });
|
||||||
await filterBtn.click();
|
await filterBtn.click();
|
||||||
|
// Wait for slide transition to finish before interacting with contents —
|
||||||
|
// clicking during the transition triggers track_reactivity_loss in Svelte 5 async.js
|
||||||
|
// (same guard as the undated-only describe below; this block flaked in CI run 2208).
|
||||||
|
await expect.element(page.getByTestId('undated-only-toggle')).toBeVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
it('hides AND/OR toggle when fewer than 2 tags are selected', async () => {
|
it('hides AND/OR toggle when fewer than 2 tags are selected', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user