Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Mar 14, 2024
1 parent c20fd1e commit f259c2f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dashboard
Title: What the Package Does (One Line, Title Case)
Version: 0.0.3.001
Version: 0.0.3.002
Authors@R:
person(given = "First",
family = "Last",
Expand All @@ -16,3 +16,6 @@ Imports:
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.1
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "dashboard: What the Package Does (One Line, Title Case)",
"codeRepository": "https://github.com/ropensci-review-tools/dashboard",
"license": "https://spdx.org/licenses/MIT",
"version": "0.0.3.001",
"version": "0.0.3.002",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
12 changes: 12 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/special-files.html

library (testthat)
library (dashboard)

test_check ("dashboard")
23 changes: 23 additions & 0 deletions tests/testthat/test-editors.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
test_that ("editor names", {

q <- gh_editors_team_qry (stats = FALSE)
editors <- gh::gh_gql (query = q)
editors <- editors$data$organization$team$members$nodes
expect_true (length (editors) > 10L)
nms <- unique (unlist (lapply (editors, names)))
expect_identical (nms, "login") # should have 'login' only
editors <- vapply (editors, function (i) i$login, character (1L))
expect_type (editors, "character")
expect_true (length (editors) > 10L)

q <- gh_editors_team_qry (stats = TRUE)
editors_stats <- gh::gh_gql (query = q)
editors_stats <- editors_stats$data$organization$team$members$nodes
expect_true (length (editors_stats) > 5L)
expect_true (length (editors_stats) < length (editors))
nms <- unique (unlist (lapply (editors_stats, names)))
expect_identical (nms, "login") # should have 'login' only
editors_stats <- vapply (editors_stats, function (i) i$login, character (1L))
expect_type (editors_stats, "character")
expect_true (length (editors_stats) > 5L)
})

0 comments on commit f259c2f

Please sign in to comment.