tests/testthat/test-howto.R

test_that("HAPPY: howto returns results", {
  vcr::use_cassette("howto-happy-return-results", {
    with_stubbed_credentials({
      good <- air::howto("How do I get the first element of a list?") |>
        suppressMessages()
    })
  })

  expect_true(class(good) == "character")
  air:::delete_keyring_credentials()
})

test_that("HAPPY: howto prints result message", {
  vcr::use_cassette("howto-happy-print-results", {
    happy_results <- \() {
      with_stubbed_credentials({
        air::howto("How do I get the first element of a list?")
      })
    }
    expect_message(happy_results(), ".*\n+")
  })
})

Try the air package in your browser

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

air documentation built on Aug. 8, 2025, 6:46 p.m.