llm-router / apps /api /src /services /expense /shared /object-store.test.ts
ClaraSu's picture
Upload folder using huggingface_hub
6822ee4 verified
Raw History Blame Contribute Delete
885 Bytes
import { describe, it, expect } from 'vitest'
import { FakeObjectStore } from './object-store.js'
describe('FakeObjectStore', () => {
it('round-trips an uploaded object through download', async () => {
const store = new FakeObjectStore()
await store.upload('aGVsbG8=', 'slip-queue/abc.jpg')
expect(await store.download('slip-queue/abc.jpg')).toBe('aGVsbG8=')
})
it('delete removes the object so a later download throws', async () => {
const store = new FakeObjectStore()
await store.upload('aGVsbG8=', 'slip-queue/abc.jpg')
await store.delete('slip-queue/abc.jpg')
await expect(store.download('slip-queue/abc.jpg')).rejects.toThrow()
})
it('getPublicUrl returns a deterministic URL containing the key', () => {
const store = new FakeObjectStore()
expect(store.getPublicUrl('slip-queue/abc.jpg')).toContain('slip-queue/abc.jpg')
})
})