Skip to content

Commit

Permalink
Added tests for the maps() method
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Sep 9, 2023
1 parent 5addd32 commit 80b010a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/testthat/test-maps.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
library(BridgeDbR)
context("simple")

test_that("it can find mappings", {
location = paste(getwd(), "test.bridge", sep = "/")
mapper <- loadDatabase(location)
input = data.frame(
source = c("Ik"),
identifier = c("YECLLIMZHNYFCK-RRNJGNTNSA-J")
)
mappings <- maps(mapper, input)
expect_equal(nrow(mappings), 3)
})

test_that("it can find mappings for a specific target", {
location = paste(getwd(), "test.bridge", sep = "/")
mapper <- loadDatabase(location)
input = data.frame(
source = c("Ik"),
identifier = c("YECLLIMZHNYFCK-RRNJGNTNSA-J")
)
mappings <- maps(mapper, input, "Lm")
expect_equal(nrow(mappings), 1)
})

test_that("it returns an empty data frame with a non-existing identifier", {
location = paste(getwd(), "test.bridge", sep = "/")
mapper <- loadDatabase(location)
input = data.frame(
source = c("Ik"),
identifier = c("YECLLIMZHNYFCK-RRNJGNTNSA-A")
)
mappings <- maps(mapper, input)
expect_equal(nrow(mappings), 0)
})

0 comments on commit 80b010a

Please sign in to comment.