Skip to content
Snippets Groups Projects
Commit 7a58210e authored by Todor Kondić's avatar Todor Kondić
Browse files

tests: Adapt to changes.

parent 134c8483
No related branches found
No related tags found
No related merge requests found
Pipeline #68676 failed
......@@ -1612,11 +1612,6 @@ mk_shinyscreen_server <- function(projects,init) {
"available" else "unavailable"
})
output$metfrag_panel = renderUI({
ctrls = make_metfrag_panel(envopts=init$envopts)
do.call(tagList,ctrls)
})
output$entry_mf_summ_fname = renderText({
kv = req(rf_get_cindex_kval())
metfrag_gen_entry_fname(kv)
......
"Identifier","FirstBlock","PubMed_Count","Patent_Count","Related_CIDs","Synonym","MolecularFormula","SMILES","InChI","InChIKey","MonoisotopicMass","CompoundName","AnnoTypeCount","AgroChemInfo","BioPathway","DrugMedicInfo","FoodRelated","PharmacoInfo","SafetyInfo","ToxicityInfo","KnownUse","DisorderDisease","Identification"
"3","INCSWYKICIYAHB","11","280","9964159 23615184 45266758","(2S,3S)-2,3-dihydroxy-2,3-dihydrobenzoic acid","C7H8O4","C1=CC(C(C(=C1)C(=O)O)O)O","InChI=1S/C7H8O4/c8-5-3-1-2-4(6(5)9)7(10)11/h1-3,5-6,8-9H,(H,10,11)","INCSWYKICIYAHB-UHFFFAOYSA-N","156.042259","5,6-dihydroxycyclohexa-1,3-diene-1-carboxylic acid","2","0","2","0","0","2","0","0","0","0","0"
"4","HXKKHQJGJAFBHI","71","103352","4 111033 439938 446260 4631415 7311736 44150279","1-Aminopropan-2-ol","C3H9NO","CC(CN)O","InChI=1S/C3H9NO/c1-3(5)2-4/h3,5H,2,4H2,1H3","HXKKHQJGJAFBHI-UHFFFAOYSA-N","75.068414","1-aminopropan-2-ol","7","0","3","0","8","2","10","3","5","0","3"
"5","HIQNVODXENYOFK","3","13","5 25244426","3-Amino-2-oxopropyl phosphate","C3H8NO5P","C(C(=O)COP(=O)(O)O)N","InChI=1S/C3H8NO5P/c4-1-3(5)2-9-10(6,7)8/h1-2,4H2,(H2,6,7,8)","HIQNVODXENYOFK-UHFFFAOYSA-N","169.014009","(3-amino-2-oxopropyl) dihydrogen phosphate","2","0","2","0","0","2","0","0","0","0","0"
"6","VYZAHLCBVHPDDF","3142","20129","6","1-chloro-2,4-dinitrobenzene","C6H3ClN2O4","C1=CC(=C(C=C1[N+](=O)[O-])[N+](=O)[O-])Cl","InChI=1S/C6H3ClN2O4/c7-5-2-1-4(8(10)11)3-6(5)9(12)13/h1-3H","VYZAHLCBVHPDDF-UHFFFAOYSA-N","201.978134","1-chloro-2,4-dinitrobenzene","9","0","5","3","2","7","11","3","7","1","2"
......@@ -9,29 +9,13 @@ test_that("Preparation for app start",{withr::with_tempdir({
dir.create(ddbdir)
mrt = "mrt.fake.jar"
saveRDS("",file=mrt)
expect_error(prepare_app(dir_before=dbef,
projects=dproj,
top_data_dir=ddata,
metfrag_db_dir=ddbdir,
metfrag_runtime="absent.jar"),
class="mf-jar-absent")
expect_error(prepare_app(dir_before=dbef,
projects="absent",
top_data_dir=ddata,
metfrag_db_dir=ddbdir,
metfrag_runtime=mrt),
top_data_dir=ddata),
class="projects-absent")
expect_error(prepare_app(dir_before=dbef,
projects=dproj,
top_data_dir="absent",
metfrag_db_dir=ddbdir,
metfrag_runtime=mrt),
top_data_dir="absent"),
class="top-data-dir-absent")
expect_error(prepare_app(dir_before=dbef,
projects=dproj,
top_data_dir=ddata,
metfrag_db_dir="absent",
metfrag_runtime=mrt),
class="mf-db-dir-absent")
})})
test_that("Test make_metfrag_panel (local and remote)",{
withr::with_tempdir({
mfdb = "demodb.csv"
mfdbdir = "demodir"
dir.create(mfdbdir)
mfjar = "demomf.jar"
saveRDS("",file.path(mfdbdir,mfdb))
saveRDS("",mfjar)
eo = envopts(metfrag_db_dir = mfdbdir,
metfrag_jar = mfjar)
xx = make_metfrag_panel(eo)
res = sapply(METFRAG_DATABASE_TYPE,function (p) {grepl(p,xx[[6L]])})
expect_true(all(res))
})
})
test_that("Test make_metfrag_panel (remote)",{
withr::with_tempdir({
mfjar = "demomf.jar"
saveRDS("",mfjar)
eo = envopts(metfrag_jar = mfjar)
xx = make_metfrag_panel(eo)
res = sapply(METFRAG_REMOTE_DATABASE_TYPE,function (p) {grepl(p,xx[[6L]])})
expect_true(all(res))
res2 = sapply(METFRAG_LOCAL_DATABASE_TYPE,function (p) {grepl(p,xx[[6L]])})
expect_false(any(res2))
})
})
test_that("Test make_metfrage_panel (disabled)",{
eo = envopts()
xx = make_metfrag_panel(eo)
expect_true(length(xx)==1L)
})
......@@ -33,9 +33,11 @@ test_that("Test full project creation.",{
dir.create(db_dir)
mf_jar = "bingo.jar"
saveRDS(" ",mf_jar)
mf_db = file.path(db_dir,"bingo.csv")
saveRDS(" ",mf_db)
conf$metfrag$db_file = basename(mf_db)
db = data.frame(a=1,b=2)
mf_or_db = system.file("testdata","example_db.csv",package="shinyscreen")
file.copy(from = mf_or_db,
to = db_dir)
conf$metfrag$db_file = basename(mf_or_db)
yaml::write_yaml(conf,file.path(ppath,FN_CONF))
eo = envopts(metfrag_db_dir=db_dir,
metfrag_jar=mf_jar)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment