tests/testthat/test-find_risk.R

test_that("getRiskLevel - check output type & value",{

  risk_level <- getRiskLevel(long = -0.08189974,
                             lat = 51.31244,
                             region_col_name = "NAME",
                             risk_col_name = "PROB_4BAND",
                             shapefile_divided = divideNChunks(shapefile,
                                                               shapefile_bounds,
                                                               "NAME"),
                             shapefile_bounds = shapefile_bounds)

  expect_type(risk_level, "character")

  expect_equal(risk_level, "Medium")
})

test_that("generateFloodRiskMap - check output type & value",{

  flood_risk_map <- generateFloodRiskMap(long = -0.08189974, lat = 51.31244, region_col_name = "NAME",
                                         risk_col_name = "PROJ_4BAND",
                                         shapefile = shapefile,
                                         shapefile_divided = divideNChunks(shapefile = shapefile,
                                                                           shapefile_bounds = shapefile_bounds,
                                                                           "NAME"),
                                         shapefile_bounds = shapefile_bounds)

  expect_type(flood_risk_map, "list")

  expect_equal(class(flood_risk_map), c("leaflet", "htmlwidget"))
})
mur4mat/floodshp documentation built on Dec. 16, 2019, 12:37 a.m.