Skip to content

Commit 72cc870

Browse files
committed
Add test that work
1 parent d12be13 commit 72cc870

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/testthat/test-pxweb_v2.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ test_that(desc = "pxweb API v2", {
55
skip_if_offline()
66

77
# API v1
8-
pxapi_1 <- pxweb(url = "https://api.scb.se/OV0104/v1/doris/sv/ssd/START/ME/ME0104/ME0104C/ME0104T24")
8+
expect_silent(pxapi_1 <- pxweb(url = "https://api.scb.se/OV0104/v1/doris/sv/ssd/START/ME/ME0104/ME0104C/ME0104T24"))
99
expect_equal(pxapi_1$version, "v1")
1010

11-
pxapi_2 <- pxweb(url = "https://api.scb.se/OV0104/v1/doris/sv")
11+
expect_silent(pxapi_2 <- pxweb(url = "https://api.scb.se/OV0104/v1/doris/sv"))
1212
expect_equal(pxapi_2$version, "v1")
1313

1414
# Example table id from SCB v2 documentation.
1515
metadata_url <- "https://statistikdatabasen.scb.se/api/v2/tables/TAB5974/metadata"
16-
pxapi_v2 <- pxweb(url = metadata_url)
16+
expect_silent(pxapi_v2 <- pxweb(url = metadata_url))
1717
expect_equal(pxapi_v2$version, "v2")
1818

19+
# Metadata is working
20+
metadata_url <- "https://statistikdatabasen.scb.se/api/v2/tables/TAB5974/metadata"
21+
expect_silent(pxapi_v2 <- pxweb_get(url = metadata_url))
22+
1923
})
2024

0 commit comments

Comments
 (0)