Skip to content

Commit

Permalink
Merge pull request #68 from mskilab/as.patch
Browse files Browse the repository at this point in the history
add tests for cases in which bad ref names are provided.
  • Loading branch information
ShaiberAlon authored Dec 2, 2021
2 parents d6f50d6 + 6711616 commit 4ee045e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/testthat/test_jsUtils.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,22 @@ test_that('gen_js_instance', {
kag.col = 'bad.kag', # provide a bad karyograph file that does not contain segstats. Things should still work, but a warning is expected
annotation = NULL)

# bad ref name
system(paste0('rm -rf ', paste0(tmpdir, '/gGnome.js3')))
expect_error(gGnome.js(js_data,
outdir = paste0(tmpdir, '/gGnome.js3'),
reference = 'no_such_ref',
annotation = NULL))

# bad ref dir
bad_ref_dir = paste0(tmpdir, '/bad_ref_dir')
dir.create(bad_ref_dir, showWarnings = FALSE)
system(paste0('rm -rf ', paste0(tmpdir, '/gGnome.js3')))
expect_error(gGnome.js(js_data,
outdir = paste0(tmpdir, '/gGnome.js3'),
reference = bad_ref_dir,
annotation = NULL))

expect_error(gGnome.js(data.table(sample = 'mypair2', coverage = cov.fn, graph = gg.rds),
outdir = paste0(tmpdir, '/gGnome.js'),
cov.field ='no.such.field',
Expand Down Expand Up @@ -168,6 +184,17 @@ test_that('gen_js_instance', {
expect_error(is.dir.a.PGV.instance('/dev/null'))
expect_error(is.dir.a.gGnome.js.instance('/dev/null'))

# provide an invalid ref
expect_error(pgv(data.table(sample = 'mypair2', coverage = cov.fn, graph = gg.rds),
outdir = paste0(tmpdir, '/PGV_errored'),
ref = 'test_ref_error',
cov.field = NA,
annotation = NULL,
tree = 'nofilehere',
dataset_name = 'test'
))


})


Expand Down

0 comments on commit 4ee045e

Please sign in to comment.