-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest-get_billable_candidates.R
45 lines (41 loc) · 1.12 KB
/
test-get_billable_candidates.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
testthat::test_that("get_billable_candidates returns the correct names", {
redcapcustodian::set_script_run_time()
# build test tables in memory
conn <- DBI::dbConnect(duckdb::duckdb(), dbdir = ":memory:")
purrr::walk(get_billable_candidates_test_tables, create_a_table_from_rds_test_data, conn, "get_billable_candidates")
# DBI::dbListTables(conn)
expected_names <- c(
"project_owner_email",
"project_owner_full_name",
"project_owner_username",
"primary_uf_fiscal_org",
"dept_name",
"fiscal_contact_name",
"fiscal_contact_email",
"user_suspended_time",
"user_lastlogin",
"project_id",
"project_creation_time",
"creation_month",
"project_is_mature",
"sequestered",
"is_deleted",
"record_count",
"last_logged_event",
"is_deleted_but_not_paid",
"invoice_number",
"fiscal_year",
"month_invoiced",
"status.line_item",
"project_irb_number",
"project_title"
)
testthat::expect_named(
get_billable_candidates(
rc_conn = conn,
rcc_billing_conn = conn
),
expected_names
)
DBI::dbDisconnect(conn, shutdown = TRUE)
})