Skip to content

Commit b864735

Browse files
committed
Extract study_level creation
1 parent 49176f2 commit b864735

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

tests/testthat/setup.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,13 @@ make_define_spec <- function() {
9393
)
9494
)
9595
}
96+
97+
study <- tibble::tibble(
98+
study_name = "CDISC01",
99+
study_description = "CDISC Pilot Study",
100+
protocol_name = "CDISC01",
101+
standard_name = "ADaM",
102+
standard_version = "1.1",
103+
define_version = "2.0",
104+
language = "en"
105+
)

tests/testthat/test-metacore-define.R

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test_that("NULL study_level produces empty tibble with correct columns", {
4848
test_that("NULL documents produces empty tibble with correct columns", {
4949
spec <- metacore(
5050
mc_define$ds_spec, mc_define$ds_vars, mc_define$var_spec, mc_define$value_spec, mc_define$derivations, mc_define$codelist,
51-
mc_define$supp, sl, documents = NULL, mc_define$comments, define_fields = TRUE, verbose = "silent"
51+
mc_define$supp, study, documents = NULL, mc_define$comments, define_fields = TRUE, verbose = "silent"
5252
)
5353
expect_equal(names(spec$documents), names(define_column_schema()$.documents))
5454
expect_equal(nrow(spec$documents), 0L)
@@ -57,7 +57,7 @@ test_that("NULL documents produces empty tibble with correct columns", {
5757
test_that("NULL comments produces empty tibble with correct columns", {
5858
spec <- metacore(
5959
mc_define$ds_spec, mc_define$ds_vars, mc_define$var_spec, mc_define$value_spec, mc_define$derivations, mc_define$codelist,
60-
mc_define$supp, sl, mc_define$documents, comments = NULL, define_fields = TRUE, verbose = "silent"
60+
mc_define$supp, study, mc_define$documents, comments = NULL, define_fields = TRUE, verbose = "silent"
6161
)
6262
expect_equal(names(spec$comments), names(define_column_schema()$.comments))
6363
expect_equal(nrow(spec$comments), 0L)
@@ -67,19 +67,9 @@ test_that("NULL comments produces empty tibble with correct columns", {
6767
# Provided data is stored correctly --------------------------------------------
6868

6969
test_that("provided study_level data is stored with correct values", {
70-
sl <- tibble::tibble(
71-
study_name = "CDISC01",
72-
study_description = "CDISC Pilot Study",
73-
protocol_name = "CDISC01",
74-
standard_name = "ADaM",
75-
standard_version = "1.1",
76-
define_version = "2.0",
77-
language = "en"
78-
)
79-
8070
spec <- metacore(
8171
mc_define$ds_spec, mc_define$ds_vars, mc_define$var_spec, mc_define$value_spec, mc_define$derivations, mc_define$codelist,
82-
mc_define$supp, sl, mc_define$documents, mc_define$comments, define_fields = TRUE, verbose = "silent"
72+
mc_define$supp, study, mc_define$documents, mc_define$comments, define_fields = TRUE, verbose = "silent"
8373
)
8474

8575
expect_equal(nrow(spec$study_level), 1L)

0 commit comments

Comments
 (0)