context("get_plot_time_labels.R")

source("tools/libs.R")
source("modules/Visualization/R/get_variable_longname.R")
###########################################

data_cube <- CSTools::lonlat_temp$exp
index <- 1
test_that("1. Get variable longname from dictionary", {
  var_longname <- .get_variable_longname(data_cube = data_cube,
                                         index = index,
                                         format = "MyCase")
  # Results
  expect_equal(
    var_longname,
    "2-metre air temperature"
  )
})

test_that("2. Format not present in dictionary", {
  expect_warning(
    var_longname <- .get_variable_longname(data_cube = data_cube,
                                           index = index,
                                           format = "Null"),
    "No configuration file found for this variable long name. Using s2dv_cube metadata."
  )
  # Results
  expect_equal(
    var_longname,
    "2 Metre Temperature"
  )
})

test_that("3. Format is NULL", {
  expect_warning(
    var_longname <- .get_variable_longname(data_cube = data_cube,
                                           index = index,
                                           format = NULL),
    "No configuration file found for this variable long name. Using s2dv_cube metadata."
  )
  # Results
  expect_equal(
    var_longname,
    "2 Metre Temperature"
  )
})
