tests/testthat/test-analyze_factor.R

test_that("Metadata is invalid", {
  tcga_meta_mat <- as.matrix(tcga_meta_clean)
  ca_info <- run_ca(tcga_meta_clean)

  # Testing whether it is a data frame.
  expect_error(
    analyze_factor(tcga_meta_mat, ca_info$fi_mat),
    "Metadata is either not a data frame or did not undergo cleaning."
    )

  # Testing whether the class is metaStandard
  class(tcga_meta_clean) <- "data.frame"
  expect_error(
    analyze_factor(tcga_meta_clean, ca_info$fi_mat),
    "Metadata is either not a data frame or did not undergo cleaning."
    )

  # Testing whether factor scores are in a matrix.

})


test_that("Factor score object is invalid", {
  ca_info <- run_ca(tcga_meta_clean)

  expect_error(
    analyze_factor(tcga_meta_clean, as.data.frame(ca_info$fi_mat)),
    "Factor scores are not in a matrix."
  )
})
ahnjedid/MetaConIdentifier documentation built on Dec. 18, 2021, 11:26 p.m.