Skip to content

Commit

Permalink
adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
veverkap authored and lpil committed Aug 11, 2019
1 parent f6896b4 commit 4799665
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion test/icalendar_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,46 @@ defmodule ICalendarTest do
"""
end

test "Icalender.to_ics/1 with url" do
events = [
%ICalendar.Event{
summary: "Film with Amy and Adam",
dtstart: Timex.to_datetime({{2015, 12, 24}, {8, 30, 00}}),
dtend: Timex.to_datetime({{2015, 12, 24}, {8, 45, 00}}),
description: "Let's go see Star Wars, and have fun.",
location: "123 Fun Street, Toronto ON, Canada",
url: "http://example.com"
}
]

ics = %ICalendar{events: events} |> ICalendar.to_ics()

assert ics == """
BEGIN:VCALENDAR
CALSCALE:GREGORIAN
VERSION:2.0
PRODID:-//Elixir ICalendar//Elixir ICalendar//EN
BEGIN:VEVENT
DESCRIPTION:Let's go see Star Wars\\, and have fun.
DTEND:20151224T084500Z
DTSTART:20151224T083000Z
LOCATION:123 Fun Street\\, Toronto ON\\, Canada
SUMMARY:Film with Amy and Adam
URL:http://example.com
END:VEVENT
END:VCALENDAR
"""
end

test "ICalender.to_ics/1 -> ICalendar.from_ics/1 and back again" do
events = [
%ICalendar.Event{
summary: "Film with Amy and Adam",
dtstart: Timex.to_datetime({{2015, 12, 24}, {8, 30, 00}}),
dtend: Timex.to_datetime({{2015, 12, 24}, {8, 45, 00}}),
description: "Let's go see Star Wars, and have fun.",
location: "123 Fun Street, Toronto ON, Canada"
location: "123 Fun Street, Toronto ON, Canada",
url: "http://www.example.com"
}
]

Expand Down

0 comments on commit 4799665

Please sign in to comment.