tests/testthat/test-gh_gql.R

test_that("gh_gql posts to /graphql and returns parsed response", {
  local_fake_github()
  res <- gh_gql("query { viewer { login } }")
  expect_equal(res$data$viewer$login, "fakeuser")
  expect_equal(res$data$echo, "query { viewer { login } }")
})

test_that("gh_gql rejects .limit", {
  expect_snapshot(
    error = TRUE,
    gh_gql("query { viewer { login } }", .limit = 5)
  )
})

Try the gh package in your browser

Any scripts or data that you put into this service are public.

gh documentation built on May 29, 2026, 5:07 p.m.