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.

479 B
Raw Blame
import { expect, vi } from 'vite-plus/test'

/** Call explicitly during test setup and register the returned teardown with onTestFinished. */
export function guardUnexpectedFetch() {
  const unexpectedFetch = vi
    .fn<typeof fetch>()
    .mockRejectedValue(new Error('Unexpected network request'))
  vi.stubGlobal('fetch', unexpectedFetch)

  return () => {
    try {
      expect(unexpectedFetch).not.toHaveBeenCalled()
    } finally {
      vi.unstubAllGlobals()
    }
  }
}