> test ATTACH
ATTACH:https://example.com/foo.pdf
> convert
"links": {
  "245708bf-8e07-5d3b-a5da-2974a63c3b91": {
    "@type": "Link",
    "href": "https://example.com/foo.pdf",
    "rel": "enclosure"
  }
},
"iCalendar": {
    "convertedProperties": {
        "links/245708bf-8e07-5d3b-a5da-2974a63c3b91/href": {
        "name": "attach"
        }
    },
    "name": "vevent"
}

> test ATTACH with FMTTYPE
ATTACH;ENCODING=BASE64;VALUE=BINARY;FMTTYPE=image/png:iVBORw
 0KGgoAAAANSUhEUgAAAAEAAAABAQAAAAA3bvkkAAAAAmJLR0QAAd2KE6QAA
 AAKSURBVAjXY2gAAACCAIHdQ2r0AAAAAElFTkSuQmCC
> convert
"links": {
  "ac521dc6-ccfa-56e1-9ecc-94ced0a5b4ea": {
    "@type": "Link",
    "href": "data:;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQAAAAA3bvkkAAAAAmJLR0QAAd2KE6QAAAAKSURBVAjXY2gAAACCAIHdQ2r0AAAAAElFTkSuQmCC",
    "contentType": "image/png",
    "rel": "enclosure"
  }
},
"iCalendar": {
    "convertedProperties": {
        "links/ac521dc6-ccfa-56e1-9ecc-94ced0a5b4ea/href": {
        "name": "attach",
        "parameters": {
            "value": "BINARY"
        }
        }
    },
    "name": "vevent"
}

> test ATTACH with FILENAME
ATTACH;FILENAME=foo.pdf:https://example.com/foo.pdf
> convert
"links": {
  "245708bf-8e07-5d3b-a5da-2974a63c3b91": {
    "@type": "Link",
    "href": "https://example.com/foo.pdf",
    "title": "foo.pdf",
    "rel": "enclosure"
  }
},
"iCalendar": {
    "convertedProperties": {
        "links/245708bf-8e07-5d3b-a5da-2974a63c3b91/href": {
        "name": "attach"
        }
    },
    "name": "vevent"
}

> test IMAGE
IMAGE;FMTTYPE=image/png;DISPLAY=BADGE,THUMBNAIL;FILENAME="An image":
 https://example.com/images/party.png
> convert
"links": {
  "2c42ac17-1eaf-5a75-a216-aef848785d79": {
    "@type": "Link",
    "href": "https://example.com/images/party.png",
    "display": {
      "badge": true,
      "thumbnail": true
    },
    "contentType": "image/png",
    "title": "An image",
    "rel": "icon"
  }
},
"iCalendar": {
        "convertedProperties": {
          "links/2c42ac17-1eaf-5a75-a216-aef848785d79/href": {
            "name": "image"
          }
        },
        "name": "vevent"
}

> test IMAGE with LABEL
IMAGE;FMTTYPE=image/png;DISPLAY=BADGE;LABEL="An image":
 https://example.com/images/party.png
> convert
"links": {
  "2c42ac17-1eaf-5a75-a216-aef848785d79": {
    "@type": "Link",
    "href": "https://example.com/images/party.png",
    "display": {
      "badge": true
    },
    "contentType": "image/png",
    "rel": "icon"
  }
},
"iCalendar": {
        "convertedProperties": {
          "links/2c42ac17-1eaf-5a75-a216-aef848785d79/href": {
            "name": "image",
            "parameters": {
              "label": "An image"
            }
          }
        },
        "name": "vevent"
}

> test LINK
LINK;LINKREL=preview;LABEL=Venue:
 https://example.com/events
> convert
"links": {
  "63023b12-fcf4-53fa-841d-8c1684b9f80b": {
    "@type": "Link",
    "href": "https://example.com/events",
    "title": "Venue",
    "rel": "preview"
  }
},
"iCalendar": {
        "convertedProperties": {
          "links/63023b12-fcf4-53fa-841d-8c1684b9f80b/href": {
            "name": "link"
          }
        },
        "name": "vevent"
}

> test URL
URL:https://example.com/myurl
> convert
"links": {
  "6669391a-2c73-5b89-9cfe-7a6c95a855e3": {
    "@type": "Link",
    "href": "https://example.com/myurl",
    "rel": "describedby"
  }
},
"iCalendar": {
        "convertedProperties": {
          "links/6669391a-2c73-5b89-9cfe-7a6c95a855e3/href": {
            "name": "url"
          }
        },
        "name": "vevent"
}

> test URL with LABEL
URL;LABEL=Homepage:https://example.com/myurl
> convert
"links": {
  "6669391a-2c73-5b89-9cfe-7a6c95a855e3": {
    "@type": "Link",
    "href": "https://example.com/myurl",
    "title": "Homepage",
    "rel": "describedby"
  }
},
"iCalendar": {
        "convertedProperties": {
          "links/6669391a-2c73-5b89-9cfe-7a6c95a855e3/href": {
            "name": "url"
          }
        },
        "name": "vevent"
}

> test URL in a VCALENDAR component
BEGIN:VCALENDAR
UID:cal1
URL:https://example.com/cal
BEGIN:VEVENT
UID:event1
END:VEVENT
END:VCALENDAR
> convert
{
  "@type": "Group",
  "uid": "cal1",
  "links": {
    "56e87d42-b5a8-59a7-abe3-26d4d609b625": {
      "@type": "Link",
      "href": "https://example.com/cal",
      "rel": "describedby"
    }
  },
  "iCalendar": {
    "convertedProperties": {
      "links/56e87d42-b5a8-59a7-abe3-26d4d609b625/href": {
        "name": "url"
      }
    },
    "name": "vcalendar"
  },
  "entries": [
    {
      "@type": "Event",
      "uid": "event1"
    }
  ]
}

> test URL and a second describedby Link
URL:https://example.com/a
LINK;LINKREL=describedby:https://example.com/b
> convert
"links": {
  "c3e2ef56-00e8-5f96-9185-a9f4fcac0d27": {
    "@type": "Link",
    "href": "https://example.com/a",
    "rel": "describedby"
  },
  "a770beff-874b-572e-99ea-12f365fcdcb9": {
    "@type": "Link",
    "href": "https://example.com/b",
    "rel": "describedby"
  }
},
"iCalendar": {
        "convertedProperties": {
          "links/c3e2ef56-00e8-5f96-9185-a9f4fcac0d27/href": {
            "name": "url"
          },
          "links/a770beff-874b-572e-99ea-12f365fcdcb9/href": {
            "name": "link"
          }
        },
        "name": "vevent"
}

> test ATTACH with JSPROP
ATTACH;JSID=mylink1:https://www.rfc-editor.org/rfc/rfc8984.html
JSPROP;JSPTR="links/mylink1/example.com:foo":"bar"
> convert
"links": {
  "mylink1": {
    "@type": "Link",
    "href": "https://www.rfc-editor.org/rfc/rfc8984.html",
    "example.com:foo": "bar",
    "rel": "enclosure"
  }
},
"iCalendar": {
        "convertedProperties": {
          "links/mylink1/href": {
            "name": "attach"
          }
        },
        "name": "vevent"
}

> test LINK, ATTACH, IMAGE and URL together
LINK;LINKREL=preview;LABEL=Venue:
 https://example.com/events
ATTACH:https://example.com/foo.pdf
IMAGE;FMTTYPE=image/png;DISPLAY=BADGE,THUMBNAIL;FILENAME="An image":
 https://example.com/images/party.png
URL:https://example.com/myurl
> convert
{
  "@type": "Group",
  "entries": [
    {
      "@type": "Event",
      "iCalendar": {
        "convertedProperties": {
          "links/245708bf-8e07-5d3b-a5da-2974a63c3b91/href": {
            "name": "attach"
          },
          "links/2c42ac17-1eaf-5a75-a216-aef848785d79/href": {
            "name": "image"
          },
          "links/63023b12-fcf4-53fa-841d-8c1684b9f80b/href": {
            "name": "link"
          },
          "links/6669391a-2c73-5b89-9cfe-7a6c95a855e3/href": {
            "name": "url"
          }
        },
        "name": "vevent"
      },
      "links": {
        "245708bf-8e07-5d3b-a5da-2974a63c3b91": {
          "@type": "Link",
          "href": "https://example.com/foo.pdf",
          "rel": "enclosure"
        },
        "2c42ac17-1eaf-5a75-a216-aef848785d79": {
          "@type": "Link",
          "contentType": "image/png",
          "display": {
            "badge": true,
            "thumbnail": true
          },
          "href": "https://example.com/images/party.png",
          "rel": "icon",
          "title": "An image"
        },
        "63023b12-fcf4-53fa-841d-8c1684b9f80b": {
          "@type": "Link",
          "href": "https://example.com/events",
          "rel": "preview",
          "title": "Venue"
        },
        "6669391a-2c73-5b89-9cfe-7a6c95a855e3": {
          "@type": "Link",
          "href": "https://example.com/myurl",
          "rel": "describedby"
        }
      }
    }
  ]
}
