Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

652 B
Raw Blame
import { vi } from 'vite-plus/test'

/** Resolve fixture image data without allowing unrelated network requests. */
export function mockFixtureImageFetch() {
  const originalFetch = globalThis.fetch
  vi.spyOn(globalThis, 'fetch').mockImplementation((input, init) => {
    if (typeof input === 'string' && input.startsWith('data:image/gif;base64,')) {
      const encoded = input.slice(input.indexOf(',') + 1).split('#')[0]!
      const bytes = Uint8Array.from(atob(encoded), (character) => character.charCodeAt(0))
      return Promise.resolve(new Response(new Blob([bytes], { type: 'image/gif' })))
    }
    return originalFetch(input, init)
  })
}