tests/testthat/test-plot_factor_scores.R

test_that("Input is not a matrix", {
  ca_info <- run_ca(tcga_meta_clean)

  # Error expected.
  expect_error(plot_factor_scores(as.data.frame(ca_info$fi_mat)),
               "Factor scores are not in a matrix.")
})

test_that("Use optional parameter", {
  ca_info <- run_ca(tcga_meta_clean)

  # Error not expected.
  expect_error(plot_factor_scores(ca_info$fi_mat, num_factors = 5), NA)
})

test_that("Do not use optional parameter", {
  ca_info <- run_ca(tcga_meta_clean)

  # Error not expected.
  expect_error(plot_factor_scores(ca_info$fi_mat), NA)
})
ahnjedid/MetaConIdentifier documentation built on Dec. 18, 2021, 11:26 p.m.