为以下代码用jest写ut
export function ubmit(url, data, fn) {
  const downloadTest = document.getElementById('downloadTest')
  if (!downloadTest) {
    const iframe = document.createElement('iframe')
    iframe.setAttribute('id', 'downloadTest')
    iframe.setAttribute('name', 'download-test')
    iframe.style.display = 'none'
    document.body.appendChild(iframe)
  }
  const formDom = document.createElement('form')
  formDom.setAttribute('action', url)
  formDom.setAttribute('method', 'post')
  formDom.setAttribute('target', 'download-test')
  formDom.setAttribute('contentType', 'text/html')
  for (const key in data) {
    const value = data[key]
    if (Object.prototype.toString.apply(value) === '[object Object]') {
      for (var key2 in value) {
        const value2 = value[key2]
        const inputDom = document.createElement('input')
        inputDom.setAttribute('type', 'hidden')
        inputDom.setAttribute('name', `${key}[${key2}]`)
        inputDom.setAttribute('value', value2)
        formDom.appendChild(inputDom)
      }
    } else if (Object.prototype.toString.call(value) === '[object Array]') {
      let inputDom
      value.forEach((vItem) => {
        inputDom = document.createElement('input')
        inputDom.setAttribute('type', 'hidden')
        inputDom.setAttribute('name', key + '[]')
        inputDom.setAttribute('value', vItem)
        formDom.appendChild(inputDom)
      })
    } else {
      const inputDom = document.createElement('input')
      inputDom.setAttribute('type', 'hidden')
      inputDom.setAttribute('name', key)
      inputDom.setAttribute('value', value)
      formDom.appendChild(inputDom)
    }
  }
  document.body.append(formDom)
  formDom.submit()
  if (fn && typeof fn === 'function') {
    loopCheckIframe(fn)
  }
}