library(adParser)
library(testthat)
context("Get adverts functions")
test_that("get ad url works",
{
urls <- get_ad_urls("../../inst/rawdata/webpages/gumtree_main.html",
"gumtree")
expect_equal(urls[1],
"/s-ad/maryborough/dogs-puppies/purebred-chihuahua/1090925867")
}
)
test_that("get ads works",
{
expect_error(get_ads(n = 1, page = "google", animal = "dog",
dir = ".", save_html = FALSE),
"No info for that page animal combo")
expect_error(get_ads(n = 1, page = "gumtree", animal = "lemur",
dir = ".", save_html = FALSE),
"No info for that page animal combo")
# n <- get_ads(n = 1, page = "tradingpost",
# animal = "dog", dir = '.',
# save_html = FALSE, trace = FALSE)
# expect_equal(n, 20)
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.