diff --git a/tests/testthat/_snaps/plotting.md b/tests/testthat/_snaps/plotting.md new file mode 100644 index 0000000000000000000000000000000000000000..8d529ddd9bcf1dd9e00ac4f955dbcba58f0fec3f --- /dev/null +++ b/tests/testthat/_snaps/plotting.md @@ -0,0 +1,26 @@ +# narrow_summ + + Code + ns + Output + set ID set ID adduct tag mz ms1_rt ms1_int Name + 1: AAs 4 AAs 4 [M+H]+ AA 120.0655 4 70481520 Threonine + 2: AAs 4 AAs 4 [M+H]+ AA 120.0655 4 70481520 Threonine + 3: AAs 4 AAs 4 [M+H]+ AA 120.0655 4 70481520 Threonine + 4: AAs 4 AAs 4 [M+H]+ KO 120.0655 4 80851056 Threonine + 5: AAs 4 AAs 4 [M+H]+ KO 120.0655 4 80851056 Threonine + 6: AAs 4 AAs 4 [M+H]+ KO 120.0655 4 80851056 Threonine + 7: AAs 4 AAs 4 [M+H]+ WT 120.0655 5 68987250 Threonine + 8: AAs 4 AAs 4 [M+H]+ WT 120.0655 5 68987250 Threonine + 9: AAs 4 AAs 4 [M+H]+ WT 120.0655 5 68987250 Threonine + SMILES qa_ms1_exists scan ms2_sel + 1: C[C@@H](O)[C@H](N)C(O)=O TRUE F1.S000058 FALSE + 2: C[C@@H](O)[C@H](N)C(O)=O TRUE F1.S000059 TRUE + 3: C[C@@H](O)[C@H](N)C(O)=O TRUE F1.S000060 FALSE + 4: C[C@@H](O)[C@H](N)C(O)=O TRUE F1.S000267 FALSE + 5: C[C@@H](O)[C@H](N)C(O)=O TRUE F1.S000268 TRUE + 6: C[C@@H](O)[C@H](N)C(O)=O TRUE F1.S000269 FALSE + 7: C[C@@H](O)[C@H](N)C(O)=O TRUE F1.S000477 FALSE + 8: C[C@@H](O)[C@H](N)C(O)=O TRUE F1.S000478 TRUE + 9: C[C@@H](O)[C@H](N)C(O)=O TRUE F1.S000479 FALSE + diff --git a/tests/testthat/setup-plotting.R b/tests/testthat/setup-plotting.R index e11124c6d3188250ae11cda3d07a1011d785ca31..787b550d249d2ee37d793a0c7bbbfb3c2a9cecd6 100644 --- a/tests/testthat/setup-plotting.R +++ b/tests/testthat/setup-plotting.R @@ -1,7 +1,7 @@ -PLOTTING_STATE = readRDS(system.file(package="shinyscreen","testdata","plotting-state.rds")) +pre_test_state = readRDS(system.file(package="shinyscreen","testdata","plotting-state.rds")) synthetise_cgm_ms1 <- function(n,fac,shift) { @@ -127,3 +127,8 @@ fix_testing_state_conf <- function(conf) { ## dt = empty_cgram_ms1( ## } +pre_test_state$db = synthetise_pseudo_state_db(pre_test_state$db) +pre_test_state$conf = fix_testing_state_conf(pre_test_state$conf) +pre_test_state = prescreen(pre_test_state) +PLOTTING_TEST_STATE = pre_test_state +rm(pre_test_state) diff --git a/tests/testthat/test-plotting.R b/tests/testthat/test-plotting.R index 04cd8d9d59ae92c9d3fd8317d6abba3ac68d8c61..4b16e91a3bfd5e0e7ebf8bc569a1cc05d0d3339f 100644 --- a/tests/testthat/test-plotting.R +++ b/tests/testthat/test-plotting.R @@ -1,10 +1,18 @@ -test_that("get_data_from_key",{ - m = PLOTTING_STATE - m$db = synthetise_pseudo_state_db(m$db) - m$conf = fix_testing_state_conf(m$conf) - m = prescreen(m) - browser() - expect_identical(1L,1L) +test_that("narrow_summ",{ + m = PLOTTING_TEST_STATE + ## kvals = list(set="AAs",ID="5") # 5 is interesting (isobars with 19) + kvals = list(set="AAs",ID="4") + labs = c("adduct","tag") + ns = narrow_summ(db=m$db,m$out$tab$summ,kvals,labs,"mz","ms1_rt","ms1_int","Name","SMILES","qa_ms1_exists","scan","ms2_sel") + expect_snapshot(ns) +}) + +test_that("make_eic_ms1_plot",{ + m = PLOTTING_TEST_STATE + kvals = list(set="AAs",ID="4") + labs = c("adduct","tag") + plt = make_eic_ms1_plot(db=m$db,m$db$extr$cgm$ms1,m$out$tab$summ,kvals,labs) + expect_equal(1,1) })