Skip to content

Commit

Permalink
Add simple test for local codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhester committed Mar 16, 2015
1 parent ea83e2c commit 2e235e2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/testthat/test-codecov.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
context("codecov")
test_that("it generates a properly formatted json file", {

with_mock(
`httr:::perform` = function(...) list(...),
`httr::content` = identity,
`httr:::body_config` = function(...) list(...),

res <- codecov("TestS4"),
json <- jsonlite::fromJSON(res[[5]][[1]]),

expect_equal(json$files$name, "TestS4/R/TestS4.R"),
expect_equal(json$files$coverage[[1]],
c(NA, NA, NA, 5, 2, 5, 3, 5, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 1, NA, NA, NA, NA, NA, 1, NA, NA, NA, NA, NA, 1)
),
expect_equal(json$uploader, "R")
)
})

0 comments on commit 2e235e2

Please sign in to comment.