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.

952 B
Raw Blame
import {
  HumanInputSubmissionPreparationError,
  prepareHumanInputFormSubmission,
} from '../human-input-submission'

afterEach(() => vi.useRealTimers())

it('reports a disposed or failed reconnect instead of treating it as a successful submission', async () => {
  await expect(
    prepareHumanInputFormSubmission(() => Promise.resolve(false)),
  ).rejects.toBeInstanceOf(HumanInputSubmissionPreparationError)
})

it('times out when workflow readiness never arrives', async () => {
  vi.useFakeTimers()
  const pending = prepareHumanInputFormSubmission(() => new Promise<boolean>(() => {}))
  const assertion = expect(pending).rejects.toBeInstanceOf(HumanInputSubmissionPreparationError)
  await vi.advanceTimersByTimeAsync(15_000)
  await assertion
})

it('clears its timeout after readiness succeeds', async () => {
  vi.useFakeTimers()
  await prepareHumanInputFormSubmission(() => Promise.resolve(true))
  expect(vi.getTimerCount()).toBe(0)
})