Skip to content

Commit

Permalink
Add tests to cover patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
maciekbanas committed Oct 18, 2024
1 parent 3b8b654 commit cc50f2f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/testthat/_snaps/z-GitStats.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@
! Use either `with_code` of `with_files` parameter.
i If you want to search for [shiny] code in given files - use `in_files` parameter together with `with_code` instead.

# print_storage_attribute

Code
test_gitstats_priv$print_storage_attribute(storage_data = test_mocker$use(
"commits_table"), storage_name = "commits")
Output
<cli_ansi_string>
[1] [date range: 2023-06-15 - 2023-06-30]

---

Code
test_gitstats_priv$print_storage_attribute(storage_data = test_mocker$use(
"release_logs_table"), storage_name = "release_logs")
Output
<cli_ansi_string>
[1] [date range: 2023-08-01 - 2023-09-30]

# subgroups are cleanly printed in GitStats

Code
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-get_release-GitStats.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ test_that("get_release_logs works as expected", {
verbose = FALSE
)
expect_releases_table(release_logs_table)
test_mocker$cache(release_logs_table)
})
15 changes: 15 additions & 0 deletions tests/testthat/test-z-GitStats.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,21 @@ test_that("check_if_args_changed", {
)
})

test_that("print_storage_attribute", {
expect_snapshot(
test_gitstats_priv$print_storage_attribute(
storage_data = test_mocker$use("commits_table"),
storage_name = "commits"
)
)
expect_snapshot(
test_gitstats_priv$print_storage_attribute(
storage_data = test_mocker$use("release_logs_table"),
storage_name = "release_logs"
)
)
})

test_that("show_orgs print orgs properly", {
test_gitstats <- create_test_gitstats(hosts = 2)
expect_equal(
Expand Down

0 comments on commit cc50f2f

Please sign in to comment.