@@ -151,16 +151,28 @@ test_that("Single banner with one variable, recodes - categories rename, else",
151151 expect_identical(banner_data [[" Results" ]][[" age5" ]][[" categories" ]], c(" Under 25" , " Over 54" ))
152152})
153153
154- # TODO: Figure these out, maybe never.
155- # with_test_authentication({
156- # ds <- loadDataset("https://app.crunch.io/api/datasets/868e8b3e01834c45b73e56e80160d3c3/")
157- # test_that("Error handling - banner", {
158- # expect_warning(banner(ds, list(c(), "A"="art3")),
159- # "No variables found in 'Banner1' in `vars`. 'Banner1' will be ignored.")
160- #
161- # expect_error(banner(ds, list(Results = c("profile_gender")), recodes = list(profile_gender = list("Male2"="Man"))),
162- # "Responses in `recodes` must be included in variable responses. This is not true for 'Male2' in 'profile_gender'.")
163- # expect_error(banner(ds, list(Results = c("profile_gender")), recodes = list(profile_gender = list("Male"="Man", "Female"="Man"))),
164- # "Combining categories is not currently supported. Please check 'profile_gender' recodes.")
165- # })
166- # })
154+ context(" getBannerInfo" )
155+
156+ test_that(" Returns default banner" , {
157+ expect_equal(getBannerInfo(NULL ), default_banner )
158+ })
159+
160+ context(" removeInserts" )
161+
162+ test_that(" Adjustments for subtotals" , {
163+ var <- list ()
164+ theme <- list ()
165+ theme $ format_subtotals <- NULL
166+ theme $ format_headers <- NULL
167+ var $ inserts_obj <- list ()
168+ var $ inserts_obj $ test <- " Fake Object of class Subtotal"
169+ class(var $ inserts_obj $ test ) <- " Subtotal"
170+ var $ inserts_obj $ other <- " Fake Object of class Headers"
171+ class(var $ inserts_obj $ other ) <- " Headers"
172+
173+ expect_equal(
174+ removeInserts(var , theme ),
175+ list (inserts_obj = structure(list (), .Names = character (0 )),
176+ inserts = structure(list (), .Names = character (0 )))
177+ )
178+ })
0 commit comments