Files
auto_rfp/vitest.setup.ts
T
boyang-zhang 1151372e5c Dev branch improvements and bug fixes (#42)
* Add agentic mode support for LlamaParse and fix eligibility extraction

- Add agenticMode option to ParseOptions interface and Zod schema
- Enable agentic parsing by default for better multi-sheet Excel support
- Fix eligibility extraction to gracefully handle documents without
  eligibility criteria by returning empty array instead of throwing error

* Refactor project index selection to single-select with auto-save

- Change ProjectIndexSelector from multi-select checkboxes to single-select
  clickable rows with radio-style indicators
- Implement debounced auto-save (800ms) when selection changes
- Remove Edit/Save/Cancel buttons in favor of automatic persistence
- Add refreshKey prop to ProjectDocuments for efficient refetch on changes
- Update DocumentsSection to wire components with onSaveSuccess callback
- Simplify Questions page index selector to show index name with Active badge

* Fix ESLint configuration and resolve all lint errors

- Add eslint and eslint-config-next as dev dependencies
- Create .eslintrc.json with next/core-web-vitals preset
- Fix 43 unescaped entity errors by replacing quotes and apostrophes
  with HTML entities across 14 component files
- Fix 9 react-hooks/exhaustive-deps warnings by wrapping fetch
  functions in useCallback with proper dependency arrays

* Add Vitest testing infrastructure with 173 unit tests

- Configure Vitest with coverage reporting and path aliases
- Add test scripts (test, test:run, test:coverage) to package.json
- Install vitest, @vitest/coverage-v8, vite-tsconfig-paths, vitest-mock-extended

Test coverage includes:
- validators: extract-questions, generate-response, llamaparse, multi-step-response
- errors: all API error classes with type guard
- services: FileValidator (file type/size validation), DefaultResponseService
- middleware: apiHandler and withApiHandler request validation

Add mock infrastructure for Prisma, OpenAI, and test fixtures

* Fix missing agenticMode in LlamaParse processing service

Add agentic_mode field to request schema and form data parser to ensure
the agenticMode option is properly passed through the parsing pipeline.
This resolves TypeScript compilation error where agenticMode was required
in LlamaParseOptions but not provided by the processing service.

* Fix Add Manually button routing and improve Vercel preview URL handling

- Fix 404 error when clicking Add Manually button by using correct route path
  /projects/{projectId}/questions/create instead of /questions/create?projectId=
- Update magic link auth to use VERCEL_URL for preview deployments

* Simplify IndexSelector to display-only mode

Remove index configuration UI since only single file selection is now supported:
- Remove Configure/Hide toggle button and collapsible panel
- Remove Select All/Deselect All functionality
- Remove checkbox selection grid for indexes
- Clean up handleIndexToggle and handleSelectAllIndexes from provider
- Keep project card display showing active index name and status
2025-12-27 12:03:18 -06:00

23 lines
642 B
TypeScript

import { afterEach, afterAll, vi } from 'vitest';
// Mock environment variables
vi.stubEnv('OPENAI_API_KEY', 'test-openai-key');
vi.stubEnv('LLAMACLOUD_API_KEY', 'test-llamacloud-key');
vi.stubEnv('DATABASE_URL', 'postgresql://test:test@localhost:5432/test');
vi.stubEnv('NEXT_PUBLIC_SUPABASE_URL', 'https://test.supabase.co');
vi.stubEnv('NEXT_PUBLIC_SUPABASE_ANON_KEY', 'test-anon-key');
vi.stubEnv('NEXT_PUBLIC_APP_URL', 'http://localhost:3000');
// Global fetch mock
global.fetch = vi.fn();
afterEach(() => {
// Reset all mocks between tests
vi.clearAllMocks();
});
afterAll(() => {
// Global teardown
vi.unstubAllEnvs();
});