Skip to content

Commit

Permalink
Merge pull request #407 from vubiostat/jubilee2-testthat-1
Browse files Browse the repository at this point in the history
feat: Add CI test for user interface calls
  • Loading branch information
spgarbet authored Jul 31, 2024
2 parents 0edc489 + aeadbab commit aad8f34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ A future release of version 3.0.0 will introduce several breaking changes!
## 2.9.4

* Minor code refactoring
* Add test case for CI environment
* Implemented GitHub Actions for automated source code checks.

## 2.9.3
Expand Down
7 changes: 2 additions & 5 deletions tests/testthat/test-024-unlockREDCap.R
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,6 @@ test_that(
test_that(
"unlockREDCap asks for API_KEY if not stored, opens connection and stores",
{
skip_if(Sys.getenv("CI") == "1",
"CI cannot test user interactions")

m <- mock(TRUE)
stub(unlockREDCap, ".unlockYamlOverride", list()) # No yaml

Expand All @@ -399,9 +396,9 @@ test_that(

expect_true("rcon" %in% names(x))
expect_true(x$rcon)
expect_true(calls == 1) # Called to ask once
expect_equal(calls, ifelse(Sys.getenv("CI") == "1", 2, 1)) # Called to ask once
expect_called(m, 1) # Called key_set_with_value once
expect_equal(mock_args(m)[[1]], list(service="redcapAPI", username="George", password="xyz", keyring="API_KEYs"))
expect_called(n, 1) # Called .connectAndCheck
}
)
)

0 comments on commit aad8f34

Please sign in to comment.