Auto-skips when CT 102 / OLLAMA_URL is unreachable. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
27 lines
821 B
JavaScript
27 lines
821 B
JavaScript
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); });
|
|
});
|