25 lines
1.0 KiB
TypeScript
25 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { SearXngSearchProvider } from '@deepseek-ai/dsh-web-search-searxng'
|
|
|
|
/**
|
|
* Real-API smoke for the SearXNG search provider against a live instance.
|
|
* Self-skips without `$SEARXNG_BASE_URL` (CI has no endpoint), per the
|
|
* with-key e2e policy in docs/testing.md.
|
|
*/
|
|
const baseURL = process.env.SEARXNG_BASE_URL
|
|
const maybe = baseURL !== undefined && baseURL.length > 0 ? describe : describe.skip
|
|
|
|
maybe('SearXngSearchProvider real API', () => {
|
|
it('returns sources for a live query', async () => {
|
|
const provider = new SearXngSearchProvider({
|
|
baseURL: baseURL!,
|
|
...process.env.SEARXNG_LANGUAGE !== undefined && process.env.SEARXNG_LANGUAGE.length > 0
|
|
? { language: process.env.SEARXNG_LANGUAGE }
|
|
: {},
|
|
})
|
|
const result = await provider.search({ query: 'DeepSeek Harness', maxResults: 5 })
|
|
expect(result.sources.length).toBeGreaterThan(0)
|
|
for (const source of result.sources) expect(source.url).toMatch(/^https?:\/\//)
|
|
}, 30_000)
|
|
})
|