Skip to content

Commit

Permalink
- remove debug messages from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-enzlein committed Jun 5, 2024
1 parent 05394a5 commit b3a3c56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
12 changes: 2 additions & 10 deletions tests/testthat/test_loadData_bruker.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ test_that("data can be loaded and processed from Bruker Flex",
format(Sys.time(), "%H:%M:%OS")
}
setwd(dirname(common::file.find(pattern = "req.txt")))
cat("Working directory is ", getwd(), "\n")

# download test data and unzip
cat(timeNow(), "downloading Bruker Flex test data...\n")
curl::curl_download("https://figshare.com/ndownloader/files/46156791", "testdata_bruker.zip")
cat(timeNow(), "unzip Bruker test data...\n")
unzip("testdata_bruker.zip")

# overwrite settings
Expand All @@ -23,25 +21,19 @@ test_that("data can be loaded and processed from Bruker Flex",

library(shinytest2)
options(shiny.testmode = TRUE)
cat(timeNow(), "Starting app...\n")

app <- AppDriver$new(app_dir = getwd(),
name = "M2ara_bruker load test",
seed = 42,
timeout = 4.5*1e5)

cat(timeNow(), "loading spectra...\n")
app$click("load")
Sys.sleep(120)
cat(timeNow(), "processing...\n")
app$click("process")
cat(timeNow(), "done!\n")
exp <-app$get_values(export = TRUE)

cat(timeNow(), "running tests...\n")
expect_equal(exp$export$isSpectrumList, TRUE)
show_failureexpect_equal(exp$export$isSpectrumList, TRUE)
expect_equal(exp$export$numSpec, 88)

cat(timeNow(), "Sucess! Cleaning up...\n")
fs::dir_delete("Curve")
fs::file_delete("settings.csv")
fs::file_delete("testdata_bruker.zip")
Expand Down
15 changes: 0 additions & 15 deletions tests/testthat/test_loadData_mzML.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ test_that("data can be loaded and processed from mzML",
format(Sys.time(), "%H:%M:%OS")
}
setwd(dirname(common::file.find(pattern = "req.txt")))
cat("Working directory is ", getwd(), "\n")

# download test data and unzip
cat(timeNow(), "downloading mzML test data...\n")
curl::curl_download("https://figshare.com/ndownloader/files/46156788", "testdata_mzML.zip")
cat(timeNow(), "unzip mzML test data...\n")
unzip("testdata_mzML.zip")

# overwrite settings
Expand All @@ -23,45 +20,33 @@ test_that("data can be loaded and processed from mzML",

library(shinytest2)
options(shiny.testmode = TRUE)
cat(timeNow(), "Starting app...\n")
app <- AppDriver$new(app_dir = getwd(),
name = "M2ara_mzML load test",
seed = 42,
timeout = 2.4*1e5)

cat(timeNow(), "loading spectra...\n")
app$click("load")
cat(timeNow(), "processing...\n")
app$click("process")
Sys.sleep(30)
cat(timeNow(), "done!\n")

cat(timeNow(), "performing pca...\n")
app$click("doPca")
Sys.sleep(3)

cat(timeNow(), "performing clustering...\n")
app$click("doClust")
Sys.sleep(5)

cat(timeNow(), "extracting values...\n")
exp <- app$get_values(export = TRUE)

cat(timeNow(), "check loading sucess\n")
expect_equal(exp$export$isSpectrumList, TRUE)
expect_equal(exp$export$numSpec, 144)

cat(timeNow(), "check processing sucess\n")
expect_equal(exp$export$infoState, "processed")

cat(timeNow(), "check PCA sucess\n")
expect_true(is_tibble(exp$export$pca$scores))
expect_true(is_tibble(exp$export$pca$loadings))

cat(timeNow(), "check clustering sucess\n")
expect_true(latrend::is.lcModels(exp$export$clust))
expect_true(is_tibble(extractLaClusters(exp$export$clust)))
cat(timeNow(), "Cleaning up...\n")
fs::file_delete("settings.csv")
fs::dir_delete("mzML")
fs::file_delete("testdata_mzML.zip")
Expand Down

0 comments on commit b3a3c56

Please sign in to comment.