tests/testthat/test-attachment.R

test_that("attachment: specify CID", {
  cid <- "histogram"

  msg <- envelope() %>% attachment(JPGPATH, cid = cid)

  expect_true(
    grepl(
      mime_base64encode(JPGPATH),
      as.character(msg),
      fixed = TRUE
    )
  )
  expect_equal(msg$parts[[1]]$cid, cid)
})

test_that("attachment: number of files", {
  msg <- envelope()

  expect_error(msg %>% attachment())
  expect_error(msg %>% attachment(c(TXTPATH, JPGPATH)))
})
datawookie/emayili documentation built on Feb. 10, 2025, 8:23 p.m.