Skip to content

Commit 8f822c9

Browse files
committed
Updated tests and added check to ds.name
1 parent 58c655a commit 8f822c9

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

R/ds.names.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ ds.names <- function(xname=NULL, datasources=NULL){
7373
datasources <- datashield.connections_find()
7474
}
7575

76+
if(is.null(xname)){
77+
stop("Please provide the name of the input list!", call.=FALSE)
78+
}
79+
7680
calltext<-call("namesDS", xname)
7781
output<-datashield.aggregate(datasources,calltext)
7882
return(output)

tests/testthat/test-arg-ds.names.R

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@ connect.studies.dataset.cnsim(list("LAB_TSC"))
2121
context("ds.names::arg::test errors")
2222
test_that("simple ds.names errors", {
2323
expect_error(ds.names(), "Please provide the name of the input list!", fixed=TRUE)
24-
expect_error(ds.names(x="D$LAB_TSC"), "The input object must be a list.", fixed=TRUE)
24+
25+
res <- ds.names(x="D$LAB_TSC")
26+
27+
expect_length(res, 3)
28+
expect_length(res$sim1, 2)
29+
expect_length(res$sim1$error.message, 1)
30+
expect_equal(res$sim1$error.message, "The input object is not of class <list>", fixed=TRUE)
31+
expect_length(res$sim1$trace.message, 1)
32+
expect_equal(res$sim1$trace.message, "numeric")
2533
})
2634

2735
#

tests/testthat/test-smk-ds.listServersideFunctions.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ test_that("check results", {
3333
"tableDS.assign", "tapplyDS.assign", "unlist", "unListDS"
3434
))
3535
aggregate.functions <- factor(c(
36-
"NROW", "alphaPhiDS", "asFactorDS1", "asListDS",
36+
"NROW", "asFactorDS1", "asListDS",
3737
"checkNegValueDS", "classDS", "colnamesDS", "corTestDS",
3838
"covDS", "dataFrameSubsetDS1",
3939
"densityGridDS", "dimDS",

0 commit comments

Comments
 (0)