From 9f5cc9b4d2b9c227d6f3d6e63369add8b2a29846 Mon Sep 17 00:00:00 2001 From: Mengyuan Shen Date: Mon, 29 Apr 2024 11:11:24 +1000 Subject: [PATCH 1/2] update testthat for consistency reason --- tests/testthat/test-query.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-query.R b/tests/testthat/test-query.R index 2eec67a..313d121 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) From 969198f345eb891be9a62840a50c3ebfe95e250d Mon Sep 17 00:00:00 2001 From: Mengyuan Shen Date: Mon, 29 Apr 2024 15:03:02 +1000 Subject: [PATCH 2/2] a test query for import API --- tests/testthat/test-query.R | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-query.R b/tests/testthat/test-query.R index 313d121..d8b72b0 100755 --- a/tests/testthat/test-query.R +++ b/tests/testthat/test-query.R @@ -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") +})