import { LocalFileStore } from "../file-stores/index.js" export class FakeLocalFileStore extends LocalFileStore { faked: Record fallback: LocalFileStore constructor(opts: { faked?: Record fallback: LocalFileStore }) { const { dir } = opts.fallback super({ dir }) this.faked = opts.faked || {} this.fallback = opts.fallback } async keys(): Promise> { return Array.from( new Set([...(await this.fallback.keys()), ...Object.keys(this.faked)]), ) } async get(path: string): Promise { const found = this.faked[path] if (found !== undefined) { return found } else { return await this.fallback.get(path) } } }