test(ai): live ollama embed integration (gated)
Auto-skips when CT 102 / OLLAMA_URL is unreachable. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
26
tests/integration/embed_live.test.js
Normal file
26
tests/integration/embed_live.test.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
|
||||||
|
async function ollamaUp() {
|
||||||
|
try {
|
||||||
|
const res = await fetch(
|
||||||
|
(process.env.OLLAMA_URL || 'http://192.168.1.185:11434') + '/api/tags',
|
||||||
|
{ signal: AbortSignal.timeout(2_000) }
|
||||||
|
);
|
||||||
|
return res.ok;
|
||||||
|
} catch { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
|
const isUp = await ollamaUp();
|
||||||
|
|
||||||
|
describe.runIf(isUp)('Ollama live integration', () => {
|
||||||
|
it('embedText returns 768 dims for nomic-embed-text', async () => {
|
||||||
|
const { embedText } = await import('../../lib/ai/ollama.js');
|
||||||
|
const v = await embedText('the cradle aesthetic');
|
||||||
|
expect(v).toHaveLength(768);
|
||||||
|
expect(v.every(x => typeof x === 'number')).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe.skipIf(isUp)('Ollama live integration (skipped — service down)', () => {
|
||||||
|
it('placeholder', () => { expect(true).toBe(true); });
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user