Skip to content

Commit

Permalink
expand tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dimalvovs committed Jul 25, 2024
1 parent 2cc5209 commit 1dadebb
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions tests/testthat/test-preprocessing.getSpatialFeatures.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
test_that("getSpatialFeatures can read a CoGAPS object",{
sf <- getSpatialFeatures("assets/cogaps.rds")
test_that("getCogaps can read a CoGAPS object",{
sf <- getCogaps("assets/cogaps.rds")
expect_equal(ncol(sf), 3)
})

test_that("getSpatialFeatures can read a BayesTME object",{
sf <- getSpatialFeatures("assets/btme.h5ad", method = "BayesTME")
test_that("getBtme can read a BayesTME object",{
sf <- getBtme("assets/btme.h5ad")
expect_equal(ncol(sf), 3)
})

test_that("getSpatialFeatures can read a Seurat object",{
#to be defined
test_that("getSpatialFeatures fails with unsupported method",{
expect_error(getSpatialFeatures("assets/cogaps.rds", method = "unsupported"))
})

test_that("getSpatialFeatures fails with no matching feature names",{
expect_error(getSpatialFeatures("assets/cogaps.rds", method = "CoGAPS", featureNames = "no_match"))
})

test_that("getSpatialFeatures work with custom regex", {
sf <- getSpatialFeatures("assets/cogaps.rds", method = "CoGAPS", featureNames = "_1")
expect_equal(ncol(sf), 1)
})

test_that("getSpatialFeatures work with a feature name set", {
sf <- getSpatialFeatures("assets/cogaps.rds", method = "CoGAPS", featureNames = c("Pattern_1", "Pattern_2"))
expect_equal(ncol(sf), 2)
})

0 comments on commit 1dadebb

Please sign in to comment.