Nothing
# test-status.R
test_that("caged_status retorna lista com campos corretos", {
local_mocked_bindings(
caged_status = function(...) list(
online = TRUE,
latencia_ms = 42L,
mensagem = "HuggingFace repository online",
url = "https://huggingface.co/datasets/alexsandroprado/caged"
),
.package = "datacaged"
)
result <- caged_status(verbose = FALSE)
expect_type(result, "list")
expect_true(all(c("online", "latencia_ms", "mensagem", "url") %in% names(result)))
expect_type(result$online, "logical")
expect_type(result$mensagem, "character")
expect_true(is.numeric(result$latencia_ms))
})
test_that("caged_status online = TRUE quando HuggingFace acessivel", {
skip_on_cran()
skip_if_offline("huggingface.co")
skip_on_ci() # teste de integracao real — verifica conectividade real
result <- caged_status(verbose = FALSE, timeout = 15)
# Pular se HF estiver fora (teste de conectividade, nao de logica)
skip_if(!result$online, paste("HuggingFace indisponivel:", result$mensagem))
expect_true(result$online)
expect_gt(result$latencia_ms, 0)
})
test_that("caged_status verbose = FALSE nao imprime nada", {
local_mocked_bindings(
caged_status = function(...) list(
online = TRUE, latencia_ms = 10L,
mensagem = "ok", url = "https://example.com"
),
.package = "datacaged"
)
expect_silent(caged_status(verbose = FALSE))
})
test_that("caged_status verbose = TRUE nao da erro", {
skip_on_cran()
skip_if_offline("huggingface.co")
skip_on_ci() # teste de integracao real
expect_no_error(caged_status(verbose = TRUE, timeout = 15))
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.