fix: resolve TypeScript test type errors in report-pdf and bulk-import tests

- Updated mockSession to include required SessionPayload fields (siteId, name)
- Added optional chaining for metadata.location to handle null/undefined cases
- Tests now pass without validation errors

Deployed to production 2026-09-30. App running with local postgres migration complete.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015e81pY6swiKHQZDcN86CTD
This commit is contained in:
2026-09-30 14:53:10 +08:00
co-authored by Claude Haiku 4.5
parent cbc01b9de5
commit d2707ac3df
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ describe('analyzePdfsWithDeepSeek', () => {
const metadata = await analyzePdfsWithDeepSeek(pdfTexts)
expect(metadata.description).toBeDefined()
expect(metadata.date).toBeDefined()
expect(metadata.location.site).toBeDefined()
expect(metadata.location?.site).toBeDefined()
})
})
+1 -1
View File
@@ -21,7 +21,7 @@ import { withUser } from '@/lib/db/with-user'
import { buildIncidentReportPdf } from '@/lib/pdf/incident-report'
import { NextRequest } from 'next/server'
const mockSession = { sub: 'user-1', role: 'hse' as const }
const mockSession = { sub: 'user-1', role: 'hse' as const, siteId: 'site-1', name: 'Test User' }
const MOCK_INCIDENT = {
id: 'inc-1',