Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reintro test #200

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions inst/autoReport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ testAutoReportFirst:
type: dispatchment
fun: .testAutoReport
params:
- aNum: 1
- aChar: a
- anExp: Sys.Date()
aNum: 1
aChar: a
anExp: Sys.Date()
owner: ttester
ownerName: 'Tore Tester'
email:
Expand All @@ -26,9 +26,9 @@ testAutoReportSecond:
type: subscription
fun: .testAutoReport
params:
- aNum: 2.0
- aChar: '3.14'
- anExp: sessionInfo()
aNum: 2.0
aChar: '3.14'
anExp: sessionInfo()
owner: ttester
ownerName: 'Tore Tester'
email: <someone@nowhere.com>
Expand All @@ -47,10 +47,10 @@ testAutoReportThird:
package: rapbase
fun: .testAutoReport
params:
- aNum: 2.0
- aChar: '3.14'
- anExp: sessionInfo()
- bulletin: yes
aNum: 2.0
aChar: '3.14'
anExp: sessionInfo()
bulletin: yes
owner: ttester
ownerName: Tore Tester
email:
Expand All @@ -70,9 +70,9 @@ testAutoReportThird:
package: rapbase
fun: .testAutoReport
params:
- aNum: '1'
- aChar: someString
- anExp: Sys.Date()
aNum: '1'
aChar: someString
anExp: Sys.Date()
owner: ttester
ownerName: 'Tore Tester'
email: tester@skde.no
Expand All @@ -87,9 +87,9 @@ cd467ac14dd848b8798a384a3e51512c:
package: rapbase
fun: .testAutoReport
params:
- aNum: '1'
- aChar: someString
- anExp: Sys.Date()
aNum: '1'
aChar: someString
anExp: Sys.Date()
owner: ttester
ownerName: 'Tore Tester'
email: tester@skde.no
Expand Down
20 changes: 20 additions & 0 deletions tests/testthat/test-auto-report-db.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,26 @@ test_that("sample auto report data can be read from db", {
expect_equal(nrow(readAutoReportData(target = "db")), 14)
})

# For a valid test make sure there is ONE standard dummy report scheduled for
# day 90
test_that("Auto reports can be processed (shipment by email not tested)", {
check_db()
expect_message(runAutoReport(dayNumber = 90, dryRun = TRUE, target = "db"),
"No emails sent. Content is:",
all = FALSE
)
})

# Do the same for a bulletin, above conditions also apply!
test_that("Auto reports can be processed (shipment by email not tested)", {
check_db()
expect_message(
runAutoReport(dayNumber = 90, type = c("bulletin"), dryRun = TRUE, target = "db"),
"No emails sent. Content is: This is a simple",
all = FALSE
)
})

# Test autoReportServer2 with db.
# Tests are copied from test-moduleAutoReport.R since the current file
# is ready for db.
Expand Down
Loading