Skip to content

Commit

Permalink
Reintro test (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnfinn authored Dec 19, 2024
1 parent 323b0f1 commit a5fd461
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
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

0 comments on commit a5fd461

Please sign in to comment.