ruvector/studio/lib/api/apiWrappers.test.ts
rUv 814f595995 feat(studio): Add complete RuVector Studio application
Major additions:
- Complete Next.js studio application with 1600+ components
- Docker support (Dockerfile.combined, docker-compose.yml)
- GCP deployment documentation and benchmarks
- SQL benchmark scripts for performance testing
- Sentry integration for monitoring
- Comprehensive test suite and mocks

Studio features:
- Dashboard and admin interfaces
- Data visualization components
- Authentication and user management
- API integration with RuVector backend
- Static data and public assets

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 23:04:48 +00:00

31 lines
836 B
TypeScript

import { describe, it, expect, vi, beforeEach } from 'vitest'
import apiWrapper from './apiWrapper'
import { apiAuthenticate } from './apiAuthenticate'
vi.mock('lib/constants', () => ({
IS_PLATFORM: true,
API_URL: 'https://api.example.com',
}))
vi.mock('./apiAuthenticate', () => ({
apiAuthenticate: vi.fn(),
}))
describe('apiWrapper', () => {
const mockReq = {} as any
const mockRes = {
status: vi.fn().mockReturnThis(),
json: vi.fn().mockReturnThis(),
} as any
const mockHandler = vi.fn()
beforeEach(() => {
vi.clearAllMocks()
})
it('should call handler directly when withAuth is false', async () => {
await apiWrapper(mockReq, mockRes, mockHandler, { withAuth: false })
expect(mockHandler).toHaveBeenCalledWith(mockReq, mockRes)
expect(apiAuthenticate).not.toHaveBeenCalled()
})
})