Add Phase 4: code quality, CI/CD, and formatting
- testthat infrastructure with 15 tests covering env-var guards, return types for all format/save functions, and spelling - inst/WORDLIST with 52 domain terms (LightGBM, MinIO, Parquet, etc.) - Spelling test wired into devtools::test() via test-spelling.R - styler::style_file() added as step 0 in deploy.R (auto-fixes before ship) - .gitea/workflows/test.yaml: runs testthat suite on push - .gitea/workflows/lint.yaml: lychee link check + styler dry-run on push - Removed internal IP address from comment in train_production_model() - Language: en-US added to DESCRIPTION Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
48
tests/testthat/test-validation.R
Normal file
48
tests/testthat/test-validation.R
Normal file
@@ -0,0 +1,48 @@
|
||||
test_that("connect_baf() errors on missing BAF_ENDPOINT", {
|
||||
withr::with_envvar(
|
||||
c(BAF_ENDPOINT = "", BAF_KEY = "key", BAF_SECRET = "secret", BAF_BUCKET = "baf-fraud"),
|
||||
expect_error(connect_baf("some/prefix"), "BAF_ENDPOINT")
|
||||
)
|
||||
})
|
||||
|
||||
test_that("connect_baf() errors on missing BAF_KEY", {
|
||||
withr::with_envvar(
|
||||
c(BAF_ENDPOINT = "minio:9000", BAF_KEY = "", BAF_SECRET = "secret", BAF_BUCKET = "baf-fraud"),
|
||||
expect_error(connect_baf("some/prefix"), "BAF_KEY")
|
||||
)
|
||||
})
|
||||
|
||||
test_that("connect_baf() errors on missing BAF_SECRET", {
|
||||
withr::with_envvar(
|
||||
c(BAF_ENDPOINT = "minio:9000", BAF_KEY = "key", BAF_SECRET = "", BAF_BUCKET = "baf-fraud"),
|
||||
expect_error(connect_baf("some/prefix"), "BAF_SECRET")
|
||||
)
|
||||
})
|
||||
|
||||
test_that("connect_baf() errors on missing BAF_BUCKET", {
|
||||
withr::with_envvar(
|
||||
c(BAF_ENDPOINT = "minio:9000", BAF_KEY = "key", BAF_SECRET = "secret", BAF_BUCKET = ""),
|
||||
expect_error(connect_baf("some/prefix"), "BAF_BUCKET")
|
||||
)
|
||||
})
|
||||
|
||||
test_that("convert_to_parquet() errors on missing BAF_ENDPOINT", {
|
||||
withr::with_envvar(
|
||||
c(BAF_ENDPOINT = "", BAF_KEY = "key", BAF_SECRET = "secret"),
|
||||
expect_error(convert_to_parquet("01_raw", "02_intermediate"), "BAF_ENDPOINT")
|
||||
)
|
||||
})
|
||||
|
||||
test_that("convert_to_parquet() errors on missing BAF_KEY", {
|
||||
withr::with_envvar(
|
||||
c(BAF_ENDPOINT = "minio:9000", BAF_KEY = "", BAF_SECRET = "secret"),
|
||||
expect_error(convert_to_parquet("01_raw", "02_intermediate"), "BAF_KEY")
|
||||
)
|
||||
})
|
||||
|
||||
test_that("convert_to_parquet() errors on missing BAF_SECRET", {
|
||||
withr::with_envvar(
|
||||
c(BAF_ENDPOINT = "minio:9000", BAF_KEY = "key", BAF_SECRET = ""),
|
||||
expect_error(convert_to_parquet("01_raw", "02_intermediate"), "BAF_SECRET")
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user