# WARNING - Generated by {fusen} from dev/flat_kwb_simulate_inflow.Rmd: do not edit by hand # nolint: line_length_linter.

test_that("renameColumns works correctly", {
  # Create a test data frame
  df <- data.frame(
    old_name1 = 1:3,
    old_name2 = letters[1:3],
    old_name3 = c(TRUE, FALSE, TRUE)
  )

  # Define renaming rules
  renamings <- list(
    old_name1 = "new_name1",
    old_name2 = "new_name2"
  )

  # Rename columns
  renamed_df <- renameColumns(df, renamings)

  # Test that columns were renamed correctly
  expect_equal(names(renamed_df), c("new_name1", "new_name2", "old_name3"))

  # Test that column values remain unchanged
  expect_equal(renamed_df$new_name1, df$old_name1)
  expect_equal(renamed_df$new_name2, df$old_name2)
  expect_equal(renamed_df$old_name3, df$old_name3)

  # Test with NULL renamings
  expect_equal(renameColumns(df, NULL), df)
})

test_that("renameColumns handles non-existent columns", {
  df <- data.frame(a = 1:3, b = letters[1:3])
  renamings <- list(c = "d")

  # Should return original data frame unchanged
  expect_equal(renameColumns(df, renamings), df)
})
