diff --git a/tests/testthat/test-query.R b/tests/testthat/test-query.R index 2eec67a..d8b72b0 100755 --- a/tests/testthat/test-query.R +++ b/tests/testthat/test-query.R @@ -48,7 +48,7 @@ test_that("sync_assay_files() syncs appropriate files", { }) test_that("get_SingleCellExperiment() syncs appropriate files", { - temp <- get_default_cache_dir() + temp <- tempfile() test_file <- "00095cb0de0dc9528316b636fc9b3446" meta <- get_metadata() |> head(2) @@ -196,12 +196,20 @@ test_that("database_url() expect character ", { expect_s3_class("character") }) - test_that("get_metadata() expect a unique cell_type `b` is present, which comes from fibrosis database", { n_cell <- get_metadata() |> filter(cell_type_harmonised == 'b') |> as_tibble() |> nrow() expect_true(n_cell > 0) }) +test_that("import_metadata_counts() loads metadata from a SingleCellExperiment object into a parquet file", { + data(sample_sce_obj) + temp <- tempfile() + dataset_id <- "GSE122999" + import_metadata_counts(sce_obj = sample_sce_obj, + cache_dir = temp) - - + dataset_id %in% (get_metadata(cache_directory = temp) |> + dplyr::distinct(dataset_id) |> + dplyr::pull()) |> + expect(failure_message = "The correct metadata was not created") +})