export interface IObjectStore { upload(base64: string, key: string): Promise delete(key: string): Promise download(key: string): Promise getPublicUrl(key: string): string } // In-memory test double — every test in this codebase that needs object // storage uses this instead of talking to real R2. See r2-object-store.ts // for the live adapter. export class FakeObjectStore implements IObjectStore { private store = new Map() async upload(base64: string, key: string): Promise { this.store.set(key, base64) } async delete(key: string): Promise { this.store.delete(key) } async download(key: string): Promise { const value = this.store.get(key) if (value === undefined) throw new Error(`FakeObjectStore: no object for key "${key}"`) return value } getPublicUrl(key: string): string { return `https://fake.r2.dev/${key}` } }