2023-01-25 19:51:58 +01:00
|
|
|
test_that("write_ical() returns a ical object", {
|
|
|
|
df <- data.frame(
|
2023-01-26 09:20:36 +01:00
|
|
|
date = c("2020-02-10", "2020-02-11", "2020-02-11"),
|
|
|
|
date.end = c("2020-02-13",NA,NA),
|
|
|
|
title = c("Conference", "Lunch", "Walk"),
|
|
|
|
start = c("12:00:00", NA, "08:00:00"),
|
|
|
|
time.end = c("13:00:00", NA, "17:30:00"),
|
|
|
|
note = c("Hi there","Remember to come", ""),
|
|
|
|
link = c("https://icalendar.org","https://agdamsbo.github.io/stRoke/", "")
|
2023-01-25 19:51:58 +01:00
|
|
|
)
|
|
|
|
|
2023-01-26 09:20:36 +01:00
|
|
|
expect_s3_class(
|
|
|
|
write_ical(
|
|
|
|
df,
|
|
|
|
date.end = "date.end",
|
|
|
|
time.end = "time.end",
|
|
|
|
place.def = "Home",
|
|
|
|
descr = "note",
|
|
|
|
link = "link"
|
|
|
|
),
|
|
|
|
"ical"
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
test_that("write_ical() returns a ical object", {
|
|
|
|
df <- data.frame(
|
|
|
|
date = c("2020-02-10", "2020-02-11", "2020-02-11"),
|
|
|
|
date.end = c("2020-02-13",NA,NA),
|
|
|
|
title = c("Conference", "Lunch", "Walk"),
|
|
|
|
start = c("12:00:00", NA, "08:00:00"),
|
|
|
|
time.end = c("13:00:00", NA, "17:30:00"),
|
|
|
|
place = c("Home", "Work", NA),
|
|
|
|
note = c("Hi there","Remember to come", ""),
|
|
|
|
link = c("https://icalendar.org","https://agdamsbo.github.io/stRoke/", "")
|
|
|
|
)
|
|
|
|
|
|
|
|
expect_s3_class(
|
|
|
|
write_ical(
|
|
|
|
df,
|
|
|
|
date.end = "date.end",
|
|
|
|
time.end = "time.end",
|
|
|
|
place = "place",
|
|
|
|
descr = "note",
|
|
|
|
link = "link"
|
|
|
|
),
|
|
|
|
"ical"
|
|
|
|
)
|
2023-01-25 19:51:58 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
test_that("write_ical() returns error", {
|
|
|
|
df <- data.frame(
|
|
|
|
date = c("2020-02-10", "2020-02-11"),
|
|
|
|
title = c("Conference", "Lunch"),
|
|
|
|
start = c("12:00:00", NA),
|
|
|
|
end = c("13:00:00", NA),
|
|
|
|
note = c("Hi there","Remember to come"),
|
|
|
|
link = c("https://icalendar.org","https://agdamsbo.github.io/stRoke/")
|
|
|
|
)
|
|
|
|
expect_error(write_ical(df, date = "wrong"))
|
|
|
|
expect_error(write_ical(df, place = "wrong"))
|
|
|
|
expect_error(write_ical(df, title = "wrong"))
|
|
|
|
expect_error(write_ical(df, time.start = "wrong"))
|
|
|
|
expect_error(write_ical(df, time.end = "wrong"))
|
|
|
|
})
|
|
|
|
|
|
|
|
test_that("write_ical() returns error", {
|
|
|
|
df <- data.frame(
|
|
|
|
date = c("2020-02-10", "2020-02-11"),
|
|
|
|
date.end = c(NA,"2020-02-13"),
|
|
|
|
title = c("Conference", "Lunch"),
|
|
|
|
start = c("12:00:00", NA),
|
|
|
|
end = c("13:00:00", NA),
|
|
|
|
note = c("Hi there","Remember to come"),
|
|
|
|
link = c("https://icalendar.org","https://agdamsbo.github.io/stRoke/")
|
|
|
|
)
|
|
|
|
expect_error(write_ical(df,
|
|
|
|
date.end = "date.end"))
|
2023-01-26 09:20:36 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
test_that("write_ical() returns error", {
|
|
|
|
df <- data.frame(
|
|
|
|
date = c("2020-02-10", "2020-02-11"),
|
|
|
|
date.end = c("2020-02-13",NA),
|
|
|
|
title = c(NA, "Lunch"),
|
|
|
|
start = c("12:00:00", NA),
|
|
|
|
end = c("13:00:00", NA),
|
|
|
|
note = c("Hi there","Remember to come"),
|
|
|
|
link = c("https://icalendar.org","https://agdamsbo.github.io/stRoke/")
|
|
|
|
)
|
|
|
|
expect_error(write_ical(df,
|
|
|
|
date.end = "date.end"))
|
2023-01-25 19:51:58 +01:00
|
|
|
})
|