tests/testthat/test-test_connection.R

library(testthat)
library(ollamar)

test_that("test_connection function works", {
    skip_if_not(test_connection(logical = TRUE), "Ollama server not available")

    expect_equal(test_connection()$status_code, 200)
    expect_equal(test_connection(logical = TRUE), TRUE)
    expect_equal(test_connection(url = "dsfdsf")$status_code, 503)
})

Try the ollamar package in your browser

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

ollamar documentation built on April 3, 2025, 8:31 p.m.