@@ -121,6 +121,25 @@ test_that("make_supp_qual", {
121121 )
122122})
123123
124+ test_that(" combine_supp errors if inputs are not data.frames" , {
125+ # dataset not a data.frame
126+ expect_error(
127+ combine_supp(dataset = " not_df" , supp = data.frame (x = 1 )),
128+ " You must supply a domain and supplemental dataset"
129+ )
130+
131+ # supp not a data.frame
132+ expect_error(
133+ combine_supp(dataset = data.frame (x = 1 ), supp = " not_df" ),
134+ " You must supply a domain and supplemental dataset"
135+ )
136+
137+ # neither are data.frames
138+ expect_error(
139+ combine_supp(dataset = 1 , supp = 2 ),
140+ " You must supply a domain and supplemental dataset"
141+ )
142+ })
124143
125144test_that(" combine_supp" , {
126145 # ## 1 IDVAR and 1 QNAM
@@ -231,6 +250,15 @@ test_that("supp data that does not match the main data will raise a warning but
231250 expect_s3_class(out , " data.frame" )
232251})
233252
253+ test_that(" combine_supp errors if QNAM already exists in dataset" , {
254+ ae <- safetyData :: sdtm_ae
255+ ae $ AETRTEM <- " Y"
256+
257+ expect_error(
258+ combine_supp(ae , safetyData :: sdtm_suppae ),
259+ " would be created by combine_supp"
260+ )
261+ })
234262
235263test_that(" Floating point correction works" , {
236264 fp1 <- 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1
0 commit comments