test_that("The data frame to manipulate must be a data frame", {
  expect_error(
    removeReplicatedColumns(
      dataframe = 1,
      prefix = "")
  )
})

test_that("The prefix must be a string", {
  expect_error(
    removeReplicatedColumns(
      dataframe = tibble(),
      prefix = 1)
  )
})

test_that("A data frame must be returned", {
  dataframe_ <- data.frame(
    prefix_1 = c(1, NA, NA),
    prefix_2 = c(NA, 2, NA),
    prefix_3 = c(NA, NA, 3),
    another_col = c(NA, NA, 3))

  dataframeDeduplicated_ <- suppressWarnings(
    removeReplicatedColumns(
      dataframe = dataframe_,
      prefix = "prefix"))

  expect_true(is.data.frame(dataframeDeduplicated_))
})

test_that("Only the deduplicated column gets returned", {
  dataframe_ <- data.frame(
    prefix_1 = c(1, NA, NA),
    prefix_2 = c(NA, 2, NA),
    prefix_3 = c(NA, NA, 3),
    another_col = c(NA, NA, 3))
  
  dataframeDeduplicated_ <- suppressWarnings(
    removeReplicatedColumns(
      dataframe = dataframe_,
      prefix = "prefix"))

  expect_equal(ncol(dataframeDeduplicated_), 2)
})
