mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-24 22:15:18 +00:00
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>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import * as fetchModule from 'data/fetchers'
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
import pingPostgrest from './pingPostgrest'
|
|
|
|
vi.mock('./constants', () => ({ API_URL: 'https://api.example.com' }))
|
|
|
|
describe('pingPostgrest', () => {
|
|
beforeEach(() => {
|
|
vi.restoreAllMocks()
|
|
})
|
|
|
|
it('returns true if fetchHeadWithTimeout returns no error', async () => {
|
|
vi.spyOn(fetchModule, 'fetchHeadWithTimeout').mockResolvedValue({ error: undefined })
|
|
const result = await pingPostgrest('my-project')
|
|
expect(result).toBe(true)
|
|
})
|
|
|
|
it('returns false if fetchHeadWithTimeout returns an error', async () => {
|
|
vi.spyOn(fetchModule, 'fetchHeadWithTimeout').mockResolvedValue({ error: { message: 'fail' } })
|
|
const result = await pingPostgrest('my-project')
|
|
expect(result).toBe(false)
|
|
})
|
|
|
|
it('returns false if projectRef is undefined', async () => {
|
|
const result = await pingPostgrest(undefined as any)
|
|
expect(result).toBe(false)
|
|
})
|
|
|
|
it('passes timeout option to fetchHeadWithTimeout', async () => {
|
|
const spy = vi
|
|
.spyOn(fetchModule, 'fetchHeadWithTimeout')
|
|
.mockResolvedValue({ error: undefined })
|
|
await pingPostgrest('my-project', { timeout: 1234 })
|
|
expect(spy).toHaveBeenCalledWith(
|
|
'https://api.example.com/projects/my-project/api/rest',
|
|
[],
|
|
expect.objectContaining({ timeout: 1234 })
|
|
)
|
|
})
|
|
})
|