-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtestthat.R
23 lines (18 loc) · 862 Bytes
/
testthat.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(testthat)
library(gpagespeed)
context("gpagespeed functions")
test_check("gpagespeed")
# Need to set an API key to run the tests
gspeed_key = 'YOUR_API_KEY'
test_that("speedfinder function", {
expect_equal(class(speedfinder("https://www.cars.com","mobile",key=gspeed_key,filter_third_party_resources = TRUE)),
class(data.frame()))
expect_equal(nrow(speedfinder("https://www.cars.com","mobile",key=gspeed_key)), 1)
})
test_that("speedlist function", {
expect_equal(class(speedlist(c("https://www.cars.com","https://www.yahoo.com","https://www.techmeme.com"),
"mobile",key=gspeed_key)),
class(data.frame()))
expect_equal(nrow(speedlist(c("https://www.cars.com","https://www.yahoo.com","https://www.techmeme.com"),
"mobile",key=gspeed_key)), 3)
})