brackt/app/test/setup.ts
Chris Parsons 2b9ffc0b62 Fix no-explicit-any warnings and upgrade tsconfig to ES2023
- Replace all `any` types with proper types or `unknown` across ~20 files
- Add typed socket payload interfaces in draft route and useDraftSocket
- Use any[] with eslint-disable for socket.io callbacks (legitimate escape hatch)
- Bump all tsconfigs from ES2022 → ES2023 to support toSorted/toReversed
- Fix cascading type errors uncovered by removing any: Map.get narrowing,
  participant relation types, ChartDataPoint, Partial<NewSeason> indexing
- Add ParticipantResultWithParticipant type to participant-result model
- Fix test fixtures to match updated interfaces (DraftCell, ParticipantResult)
- Fix duplicate getQPStandings import in sportsSeasonId.server.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 09:40:15 -07:00

29 lines
756 B
TypeScript

import '@testing-library/jest-dom';
import { cleanup } from '@testing-library/react';
import { afterEach, vi } from 'vitest';
// Cleanup after each test
afterEach(() => {
cleanup();
});
// Mock environment variables
process.env.NODE_ENV = 'test';
// Mock Clerk
vi.mock('@clerk/react-router/server', () => ({
getAuth: vi.fn(() => Promise.resolve({ userId: 'test-user-id' })),
clerkMiddleware: vi.fn(() => (req: unknown, res: unknown, next: () => void) => next()),
rootAuthLoader: vi.fn(() => Promise.resolve({ userId: 'test-user-id' })),
}));
// Mock database context
vi.mock('~/database/context', () => ({
database: vi.fn(() => ({
query: {},
insert: vi.fn(),
update: vi.fn(),
delete: vi.fn(),
select: vi.fn(),
})),
}));