Skip to content

Commit

Permalink
include namespace on geojson_sf call in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JosiahParry committed Sep 23, 2021
1 parent 5e93cd9 commit b8e2763
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/testthat/test-parse-body.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ test_that("Test geojson parser", {
# Test sf object w/ fields
geojson <- '{"type":"FeatureCollection","features":[{"type":"Feature","properties":{"a":3},"geometry":{"type":"Point","coordinates":[1,2]}},{"type":"Feature","properties":{"a":4},"geometry":{"type":"Point","coordinates":[3,4]}}]}'
parsed <- parse_body(geojson, "application/geo+json", make_parser("geojson"))
expect_equal(parsed, geojson_sf(geojson))
expect_equal(parsed, geojsonsf::geojson_sf(geojson))

# Test sfc
geojson <- '[
{ "type":"Point","coordinates":[0,0]},
{"type":"LineString","coordinates":[[0,0],[1,1]]}
]'
parsed <- parse_body(geojson, "application/geo+json", make_parser("geojson"))
expect_equal(parsed, geojson_sf(geojson))
expect_equal(parsed, geojsonsf::geojson_sf(geojson))

# Test simple sf object
geojson <- '{ "type" : "Point", "coordinates" : [0, 0] }'
parsed <- parse_body(geojson, "application/geo+json", make_parser("geojson"))
expect_equal(parsed, geojson_sf(geojson))
expect_equal(parsed, geojsonsf::geojson_sf(geojson))

# Test geojson file
tmp <- tempfile()
Expand All @@ -140,7 +140,7 @@ test_that("Test geojson parser", {
writeLines(geojson, tmp)
val <- readBin(tmp, "raw", 1000)
parsed <- parse_body(val, "application/geo+json", make_parser("geojson"))
expect_equal(parsed, geojson_sf(geojson))
expect_equal(parsed, geojsonsf::geojson_sf(geojson))

})

Expand Down

0 comments on commit b8e2763

Please sign in to comment.