r1 <- recipe(class ~ ., data = circle_example)
r2 <- r1 |> step_adasyn(class)
r3 <- r1 |> step_bsmote(class)
r4 <- r1 |> step_downsample(class)
r5 <- r1 |> step_nearmiss(class)
r6 <- r1 |> step_rose(class)
r7 <- r1 |> step_smote(class)
r8 <- r1 |> step_tomek(class)
r9 <- r1 |> step_upsample(class)
r10 <- r1 |> step_instance_hardness(class)
r11 <- r1 |> step_cluster_centroids(class)
r12 <- r1 |> step_cnn(class)
r13 <- r1 |> step_enn(class)
r14 <- r1 |> step_kmeans_smote(class)
r15 <- r1 |> step_ncl(class)
r16 <- r1 |> step_oss(class)
r17 <- r1 |> step_smogn(x)
r18 <- r1 |> step_smoten(class)
r19 <- r1 |> step_smotenc(class)
r20 <- r1 |> step_svmsmote(class)

# ------------------------------------------------------------------------------

test_that("required packages", {
  expect_equal(required_pkgs(r2), c("recipes", "themis"))
  expect_equal(required_pkgs(r3), c("recipes", "themis"))
  expect_equal(required_pkgs(r4), c("recipes", "themis"))
  expect_equal(required_pkgs(r5), c("recipes", "themis"))
  expect_equal(required_pkgs(r6), c("recipes", "themis", "ROSE"))
  expect_equal(required_pkgs(r7), c("recipes", "themis"))
  expect_equal(required_pkgs(r8), c("recipes", "themis"))
  expect_equal(required_pkgs(r9), c("recipes", "themis"))
  expect_equal(required_pkgs(r10), c("recipes", "themis"))
  expect_equal(required_pkgs(r11), c("recipes", "themis"))
  expect_equal(required_pkgs(r12), c("recipes", "themis"))
  expect_equal(required_pkgs(r13), c("recipes", "themis"))
  expect_equal(required_pkgs(r14), c("recipes", "themis"))
  expect_equal(required_pkgs(r15), c("recipes", "themis"))
  expect_equal(required_pkgs(r16), c("recipes", "themis"))
  expect_equal(required_pkgs(r17), c("recipes", "themis"))
  expect_equal(required_pkgs(r18), c("recipes", "themis"))
  expect_equal(required_pkgs(r19), c("recipes", "themis"))
  expect_equal(required_pkgs(r20), c("recipes", "themis", "kernlab"))
})

test_that("tunable arguments", {
  expect_equal(tunable(r2)$name, c("over_ratio", "neighbors"))
  expect_equal(
    tunable(r3)$name,
    c("over_ratio", "neighbors", "all_neighbors")
  )
  expect_equal(tunable(r4)$name, "under_ratio")
  expect_equal(tunable(r5)$name, c("under_ratio", "neighbors"))
  expect_equal(tunable(r6)$name, "over_ratio")
  expect_equal(tunable(r7)$name, c("over_ratio", "neighbors"))
  expect_true(nrow(tunable(r8)) == 0)
  expect_equal(tunable(r9)$name, "over_ratio")
  expect_equal(tunable(r10)$name, c("under_ratio", "neighbors"))
})
