Skip to content

Commit

Permalink
test-qgis-algorithms.R: add test for check_algorithm_deprecation()
Browse files Browse the repository at this point in the history
  • Loading branch information
florisvdh committed Jan 6, 2024
1 parent d802fb3 commit c49cb07
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/test-qgis-algorithms.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ test_that("Internal function assert_qgis_algorithm() works", {
expect_identical(assert_qgis_algorithm("native:filedownloader"), "native:filedownloader")
})

test_that("Internal function check_algorithm_deprecation() works", {
skip_if_not(has_qgis())
algs <- qgis_algorithms()
skip_if_not(
"deprecated" %in% colnames(algs) && sum(algs$deprecated) > 0,
paste(
"There are no deprecated algorithms available.",
"Unless using no-JSON output, rewrite this test to simulate deprecated algorithms."
)
)
alg_deprecated <- sample(algs$algorithm[algs$deprecated], 1)
alg_non_deprecated <- sample(algs$algorithm[!algs$deprecated], 1)
expect_warning(check_algorithm_deprecation(alg_deprecated))
expect_no_warning(check_algorithm_deprecation(alg_non_deprecated))
})

test_that("qgis_search_algorithms() works", {
skip_if_not(has_qgis())
expect_error(qgis_search_algorithms(), "at least one of the arguments")
Expand Down

0 comments on commit c49cb07

Please sign in to comment.