mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import { describe, it, expect, vi } from 'vitest';
|
|
import { LocalFileService } from '../../AIClasses/Local/LocalFileService';
|
|
import { AIProvider } from '../../Enums/ApiProvider';
|
|
|
|
describe('LocalFileService', () => {
|
|
describe('uploadFile', () => {
|
|
it('should stamp a dummy inline fileID and resolve', async () => {
|
|
const setFileID = vi.fn();
|
|
const attachment = { setFileID } as any;
|
|
|
|
const service = new LocalFileService();
|
|
await service.uploadFile(attachment);
|
|
|
|
expect(setFileID).toHaveBeenCalledWith(AIProvider.Local, 'inline');
|
|
});
|
|
});
|
|
|
|
describe('refreshCache', () => {
|
|
it('should resolve without doing anything', async () => {
|
|
const service = new LocalFileService();
|
|
await expect(service.refreshCache()).resolves.toBeUndefined();
|
|
});
|
|
});
|
|
|
|
describe('deleteFile', () => {
|
|
it('should resolve without doing anything', async () => {
|
|
const service = new LocalFileService();
|
|
const attachment = {} as any;
|
|
await expect(service.deleteFile(attachment)).resolves.toBeUndefined();
|
|
});
|
|
});
|
|
|
|
describe('listFiles', () => {
|
|
it('should return an empty array', () => {
|
|
const service = new LocalFileService();
|
|
expect(service.listFiles()).toEqual([]);
|
|
});
|
|
});
|
|
});
|