tests/testthat/test-vessel_stats.R

test_that("Testing the vessel stats function", {
  # Fake datasets
  data("marine_stats")
  marine_stats <- marine_stats[marine_stats$vessel_id == 1960, ]

  # It is fine
  expect_equal(is.null(vessel_stats(marine_stats = marine_stats)), FALSE)

  # It is also fine (i don't use the id)
  marine_stats$vessel_id <- NULL
  expect_equal(is.null(vessel_stats(marine_stats = marine_stats)), FALSE)

  # It is a problem because the output will be empty, However it does not break the code.
  marine_stats$vessel_name <- NULL
  expect_warning(vessel_stats(marine_stats = marine_stats))
})
DouglasMesquita/marineApp documentation built on Dec. 17, 2021, 5:29 p.m.