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.

847 B
Raw Blame
import { describe, expect, it, vi } from 'vite-plus/test'
import { getFormDataHeaders, isFormData } from './form-data'

describe('form-data helpers', () => {
  it('detects form-data like objects', () => {
    const formLike = {
      append: () => {},
      getHeaders: () => ({ 'content-type': 'multipart/form-data' }),
    }
    expect(isFormData(formLike)).toBe(true)
    expect(isFormData({})).toBe(false)
  })

  it('detects native FormData', () => {
    const form = new FormData()
    form.append('field', 'value')
    expect(isFormData(form)).toBe(true)
  })

  it('returns headers from form-data', () => {
    const formLike = {
      append: vi.fn(),
      getHeaders: () => ({ 'content-type': 'multipart/form-data' }),
    }
    expect(getFormDataHeaders(formLike)).toEqual({
      'content-type': 'multipart/form-data',
    })
  })
})