File size: 952 Bytes
39e315a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import { describe, expect, it, beforeEach, afterEach, vi } from 'bun:test'
import { isModelCacheValid, getCachedModelsFromDisk, saveModelsToCache } from '../model/modelCache.js'
vi.mock('../model/ollamaModels.js', () => ({
isOllamaProvider: vi.fn(() => true),
}))
describe('modelCache', () => {
const mockModel = { value: 'llama3', label: 'Llama 3', description: 'Test model' }
describe('isModelCacheValid', () => {
it('returns false for non-existent cache', async () => {
const result = await isModelCacheValid('ollama')
expect(result).toBe(false)
})
})
describe('getCachedModelsFromDisk', () => {
it('returns null when not cache available', async () => {
const result = await getCachedModelsFromDisk()
expect(result).toBeNull()
})
})
describe('saveModelsToCache', () => {
it('has saveModelsToCache function', () => {
expect(typeof saveModelsToCache).toBe('function')
})
})
}) |