fix(review): regenerate api.ts and fix spec type
Some checks failed
CI / Unit & Component Tests (pull_request) Failing after 3m23s
CI / OCR Service Tests (pull_request) Successful in 20s
CI / Backend Unit Tests (pull_request) Successful in 3m55s
CI / fail2ban Regex (pull_request) Successful in 45s
CI / Semgrep Security Scan (pull_request) Successful in 24s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m5s

Replace manual edits to api.ts with a proper `npm run generate:api` run —
the generated output is identical for DocumentListItem (createdAt/updatedAt
were already correct), so this just removes the drift risk flagged in review.

Fix ReaderRecentDocs.svelte.spec.ts to use DocumentListItem instead of
Document for all test fixtures, matching the component's actual prop type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-25 17:25:46 +02:00
parent 2e0f85c360
commit d9e01ef1ff
3 changed files with 26 additions and 17 deletions

View File

@@ -5,24 +5,33 @@ import { page } from 'vitest/browser';
import ReaderRecentDocs from './ReaderRecentDocs.svelte';
import type { components } from '$lib/generated/api';
type Document = components['schemas']['Document'];
type DocumentListItem = components['schemas']['DocumentListItem'];
afterEach(() => {
cleanup();
});
const baseDoc: Document = {
const baseDoc: DocumentListItem = {
id: 'doc1',
title: 'Brief an Hans',
originalFilename: 'brief.pdf',
status: 'UPLOADED',
metadataComplete: true,
scriptType: 'HANDWRITING_KURRENT',
completionPercentage: 0,
receivers: [],
tags: [],
contributors: [],
matchData: {
titleOffsets: [],
senderMatched: false,
matchedReceiverIds: [],
matchedTagIds: [],
snippetOffsets: [],
summaryOffsets: []
},
createdAt: '2025-01-01T12:00:00Z',
updatedAt: '2025-01-01T12:00:00Z'
};
const updatedDoc: Document = {
const updatedDoc: DocumentListItem = {
...baseDoc,
id: 'doc2',
title: 'Urkunde 1920',
@@ -89,7 +98,7 @@ describe('ReaderRecentDocs', () => {
});
it('shows "Neu" accent-pill badge when document was created within the last 7 days', async () => {
const recentDoc: Document = {
const recentDoc: DocumentListItem = {
...baseDoc,
id: 'doc-recent',
createdAt: new Date(Date.now() - 2 * 24 * 60 * 60 * 1000).toISOString(),
@@ -113,7 +122,7 @@ describe('ReaderRecentDocs', () => {
});
it('shows "Neu" badge when document was created 6 days ago', async () => {
const almostOldDoc: Document = {
const almostOldDoc: DocumentListItem = {
...baseDoc,
id: 'doc-almost-old',
createdAt: new Date(Date.now() - 6 * 24 * 60 * 60 * 1000).toISOString(),
@@ -125,7 +134,7 @@ describe('ReaderRecentDocs', () => {
});
it('renders sender name text when sender is present', async () => {
const docWithSender: Document = {
const docWithSender: DocumentListItem = {
...baseDoc,
sender: {
id: 'p1',