Skip to content

Commit

Permalink
add online tests for Reference Genome Endpoints functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgpanw committed Jun 25, 2024
1 parent e1cbd40 commit 308b760
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/testthat/test-get_exons.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
test_that("`get_exons()` returns tibble with expected colnames", {
skip_if_offline()
result <- get_exons(gencodeId = "ENSG00000203782.5", itemsPerPage = 1) |>
suppressWarnings()

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"featureType",
"end",
"genomeBuild",
"start",
"exonId",
"source",
"chromosome",
"gencodeId",
"transcriptId",
"geneSymbol",
"gencodeVersion",
"strand",
"exonNumber"
)
)
})
27 changes: 27 additions & 0 deletions tests/testthat/test-get_gene_search.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
test_that("`get_gene_search()` returns tibble with expected colnames", {
skip_if_offline()
result <- get_gene_search("CRP")

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"chromosome",
"dataSource",
"description",
"end",
"gencodeId",
"gencodeVersion",
"geneStatus",
"geneSymbol",
"geneSymbolUpper",
"geneType",
"genomeBuild",
"start",
"strand",
"tss",
"entrezGeneId"
)
)
})
27 changes: 27 additions & 0 deletions tests/testthat/test-get_genes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
test_that("`get_genes()` returns tibble with expected colnames", {
skip_if_offline()
result <- get_genes("CRP")

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"chromosome",
"dataSource",
"description",
"end",
"entrezGeneId",
"gencodeId",
"gencodeVersion",
"geneStatus",
"geneSymbol",
"geneSymbolUpper",
"geneType",
"genomeBuild",
"start",
"strand",
"tss"
)
)
})
31 changes: 31 additions & 0 deletions tests/testthat/test-get_genomic_features.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,34 @@ test_that("`process_get_genomic_features_resp_json()` handles non-empty response
)
)
})

test_that("`get_genomic_features()` returns tibble with expected colnames",
{
skip_if_offline()
result <- get_genomic_features("brca1")

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"gencodeVersion",
"end",
"description",
"geneSymbolUpper",
"genomeBuild",
"geneStatus",
"strand",
"entrezGeneId",
"geneType",
"start",
"dataSource",
"gencodeId",
"geneSymbol",
"tss",
"chromosome",
"featureType",
"assembly"
)
)
})
29 changes: 29 additions & 0 deletions tests/testthat/test-get_gwas_catalog_by_location.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
test_that("`get_gwas_catalog_by_location()` returns tibble with expected colnames",
{
skip_if_offline()
result <- get_gwas_catalog_by_location(
start = 1,
end = 10000000,
chromosome = "chr1",
itemsPerPage = 1
) |>
suppressWarnings()

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"chromosome",
"start",
"end",
"phenotype",
"pValue",
"beta",
"pubmedId",
"snpId",
"riskAllele",
"genomeBuild"
)
)
})
33 changes: 33 additions & 0 deletions tests/testthat/test-get_neighbor_gene.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
test_that("`get_gwas_catalog_by_location()` returns tibble with expected colnames",
{
skip_if_offline()
result <- get_neighbor_gene(
pos = 1000000,
chromosome = "chr1",
bp_window = 10000,
itemsPerPage = 1
) |>
suppressWarnings()

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"chromosome",
"dataSource",
"description",
"end",
"gencodeId",
"gencodeVersion",
"geneStatus",
"geneSymbol",
"geneSymbolUpper",
"geneType",
"genomeBuild",
"start",
"strand",
"tss"
)
)
})
24 changes: 24 additions & 0 deletions tests/testthat/test-get_transcripts.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
test_that("`get_gwas_catalog_by_location()` returns tibble with expected colnames",
{
skip_if_offline()
result <- get_transcripts(gencodeId = "ENSG00000203782.5")

expect_s3_class(result, "tbl_df")

expect_identical(
names(result),
c(
"start",
"end",
"featureType",
"genomeBuild",
"transcriptId",
"source",
"chromosome",
"gencodeId",
"geneSymbol",
"gencodeVersion",
"strand"
)
)
})

0 comments on commit 308b760

Please sign in to comment.