diff --git a/inst/autoReport.yml b/inst/autoReport.yml index 6415e419..b5fb2ae6 100644 --- a/inst/autoReport.yml +++ b/inst/autoReport.yml @@ -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: @@ -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: @@ -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: @@ -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 @@ -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 diff --git a/tests/testthat/test-auto-report-db.R b/tests/testthat/test-auto-report-db.R index 568c5163..2eeeff7e 100644 --- a/tests/testthat/test-auto-report-db.R +++ b/tests/testthat/test-auto-report-db.R @@ -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.