tests/testthat/test-assert_field_distinctness.R

test_that("checks whether the uniqueness of columns in a new dataset matches the expected uniqueness", {
  mtcars_test <- return_mtcars_testfile()

  # column mpg is editted to be is_unique = True in field_info.csv
  metadata <- get_current_documentation() %>%
    dplyr::mutate(is_unique_column = ifelse(preferred_field_name == "mpg", TRUE, FALSE))

  warnings_captured <- capture_warnings(assert_field_distinctness(mtcars_test, metadata))
  expect_true(length(warnings_captured) > 0)
})

Try the vvauditor package in your browser

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

vvauditor documentation built on Jan. 19, 2026, 5:08 p.m.