Skip to content

Commit

Permalink
Merge pull request #67 from The-Strategy-Unit/tj/nhs-r-unit-testing-fix
Browse files Browse the repository at this point in the history
removes code chunk that caused action to fail
  • Loading branch information
tomjemmett authored Aug 23, 2023
2 parents ce6b723 + 5311f9e commit 30233b4
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions presentations/2023-08-23_nhs-r_unit-testing/index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -655,30 +655,6 @@ test_that("it returns 'y' if y is bigger than x", {

## Testing complex function

```{r}
#| include: FALSE
# create a mock db/csv for this demo
withr::local_file("data.db")
withr::local_file("conditions.csv")
local({
con <- DBI::dbConnect(RSQLite::SQLite(), "data.db")
tibble::tibble(
date = format(Sys.Date() + sample(0:20, 300, TRUE), "%Y-%m-%d"),
condition = sample(letters[1:3], 300, TRUE)
) |>
dplyr::copy_to(dest = con, df = _, name = "data_table", temporary = FALSE)
DBI::dbDisconnect(con)
})
tibble::tibble(
condition = letters[1:3],
condition_type = c("important", "important", "non-important")
) |>
readr::write_csv("conditions.csv")
```

:::{.columns}

::::{.column width=70%}
Expand Down Expand Up @@ -1044,4 +1020,5 @@ The test works!

Questions?


[[email protected]](mailto:[email protected]) / DM me on slack

0 comments on commit 30233b4

Please sign in to comment.