tests/testthat/test-check.R

test_that("check_download_filename() works", {
  # missing case (default)
  galah_config(directory = "temp")
  x <- check_download_filename(file = NULL)
  expect_true(grepl(galah_config()$package$directory, x)) # contains directory
  expect_true(grepl(".zip$", x))
  # file name with no suffix
  x <- check_download_filename(file = "something")
  expect_true(grepl(galah_config()$package$directory, x)) # contains directory
  expect_true(grepl("something.zip$", x))
  # wrong suffix
  x <- check_download_filename(file = "something.csv")
  expect_true(grepl(galah_config()$package$directory, x)) # contains directory
  expect_true(grepl("something.zip$", x))
  unlink("temp")
})

Try the galah package in your browser

Any scripts or data that you put into this service are public.

galah documentation built on June 12, 2025, 5:09 p.m.