Skip to content

Commit

Permalink
get tests passing again
Browse files Browse the repository at this point in the history
  • Loading branch information
d-callan committed Feb 22, 2024
1 parent 9832c08 commit 2799e0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions tests/testthat/test-nodes.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,19 +151,19 @@ test_that("We cannot make nonsensical NodeLists", {

test_that("toJSON methods for nodes work", {
nodeA <- Node('A')
expect_equal(veupathUtils::toJSON(nodeA), '{"id":"A","degree":0}')
expect_equal(veupathUtils::toJSON(nodeA, named = TRUE), '{"node":{"id":"A","degree":0}}')
expect_equal(veupathUtils::toJSON(nodeA), '{"id":"A"}')
expect_equal(veupathUtils::toJSON(nodeA, named = TRUE), '{"node":{"id":"A"}}')

# w weights and colors
nodeB <- Node('B', color = 'red', weight = 10)
expect_equal(veupathUtils::toJSON(nodeB), '{"id":"B","color":"red","weight":10,"degree":0}')
expect_equal(veupathUtils::toJSON(nodeB, named = TRUE), '{"node":{"id":"B","color":"red","weight":10,"degree":0}}')
expect_equal(veupathUtils::toJSON(nodeB), '{"id":"B","color":"red","weight":10}')
expect_equal(veupathUtils::toJSON(nodeB, named = TRUE), '{"node":{"id":"B","color":"red","weight":10}}')

#NodeList
nodeA <- Node('A', color='blue', weight=5)
nodeList <- NodeList(list(nodeA, nodeB))
expect_equal(veupathUtils::toJSON(nodeList), '{"nodes":[{"id":"A","color":"blue","weight":5,"degree":0},{"id":"B","color":"red","weight":10,"degree":0}]}')
expect_equal(veupathUtils::toJSON(nodeList, named = FALSE), '[{"id":"A","color":"blue","weight":5,"degree":0},{"id":"B","color":"red","weight":10,"degree":0}]')
expect_equal(veupathUtils::toJSON(nodeList), '{"nodes":[{"id":"A","color":"blue","weight":5},{"id":"B","color":"red","weight":10}]}')
expect_equal(veupathUtils::toJSON(nodeList, named = FALSE), '[{"id":"A","color":"blue","weight":5},{"id":"B","color":"red","weight":10}]')

#NodeIdList
nodeIdList <- NodeIdList(list(NodeId('A'), NodeId('B')))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test_that("numBinsToBinWidth() returns a binWidth that will actually provide the
binWidth <- numBinsToBinWidth(testDF$entity.int6, 8)
viewport <- findViewport(testDF$entity.int6, 'NUMBER')
x <- bin(testDF$entity.int6, binWidth, viewport)
expect_equal(data.table::uniqueN(x),5)
expect_equal(data.table::uniqueN(x),6)

binWidth <- numBinsToBinWidth(testDF$entity.int6, 1)
viewport <- findViewport(testDF$entity.int6, 'NUMBER')
Expand Down

0 comments on commit 2799e0c

Please sign in to comment.