Test Fixtures Documentation
1 Test Fixtures Documentation
IMPACT-VIS includes test fixtures for validation and development.
1.1 Overview
Test fixtures are split between bundled demo data in app/data/ and smaller validator fixtures in tests/testthat/fixtures/.
Purpose: - Validate data loaders and validators - Exercise sample discovery and modal workflows - Demonstrate the expected file naming convention - Provide reproducible data for docs, tests, and manual QA
1.2 Bundled Demo Sample
The app ships with a complete demo bundle under app/data/:
test_sample_SNV_IMPACT.gdstest_sample_SNV_IMPACT.gds_variant_states.rdstest_sample_SV_IMPACT.tsvtest_sample_CNV_IMPACT.txttest_sample_variant_states.rds
These files support first-run exploration, modal annotation workflows, and download/export testing.
The bundled demo sample is anonymized and intended for application validation and documentation examples.
1.3 Additional Sample Bundles
The repository also includes several SNV-only sample bundles in app/data/ for sample discovery and sample-switching tests:
Case1_father_SNV_IMPACT.gdsCase1_mother_SNV_IMPACT.gdsCase1_proband_SNV_IMPACT.gdsCase2_father_SNV_IMPACT.gdsCase2_mother_SNV_IMPACT.gdsCase2_proband_SNV_IMPACT.gds
These files intentionally do not provide full SV/CNV companions for every sample.
1.4 Validator Fixtures
Smaller validator-specific fixtures live in tests/testthat/fixtures/:
annotsv.tsvfor AnnotSV validation testssample_cnv.txtfor CNV validation tests
The .create-test-gds.R.bak file in that directory is a historical scratch artifact, not a supported fixture.
1.5 Expected Validation Results
| File Type | Example Fixture | Expected Outcome |
|---|---|---|
| GDS | app/data/test_sample_SNV_IMPACT.gds |
validate_gds_file() succeeds |
| SV TSV | tests/testthat/fixtures/annotsv.tsv |
validate_sv_tsv() succeeds |
| CNV TXT | tests/testthat/fixtures/sample_cnv.txt |
validate_cnv_txt() succeeds |
1.6 Using Test Fixtures
1.6.1 In Unit Tests
box::use(
app/logic/data_manager,
app/logic/validators[validate_sv_tsv],
testthat[expect_true, test_that]
)
test_that("GDS loader works with bundled demo data", {
data <- data_manager$load_gds_data(
gds_path = "app/data/test_sample_SNV_IMPACT.gds",
num_variants = 100,
filters = list(),
bravo_thresh = 0.01
)
expect_true(!is.null(data))
})
test_that("SV validator accepts the AnnotSV fixture", {
result <- validate_sv_tsv("tests/testthat/fixtures/annotsv.tsv")
expect_true(isTRUE(result$is_valid))
})1.6.2 In Interactive Development
box::use(
app/logic/data_manager[load_cnv_data, load_gds_data, load_sv_data]
)
snv_data <- load_gds_data(
"app/data/test_sample_SNV_IMPACT.gds",
num_variants = 1000,
filters = list(),
bravo_thresh = 0.01
)
sv_data <- load_sv_data("app/data/test_sample_SV_IMPACT.tsv")
cnv_data <- load_cnv_data("app/data/test_sample_CNV_IMPACT.txt")1.7 Regenerating Fixtures
To regenerate test fixtures:
Rscript scripts/build_test_sample_fixture.RThis script: 1. Rebuilds the bundled test_sample_* demo files in app/data/ 2. Regenerates companion annotation-state files used by the modal workflow