tests/testthat/test_QueryNode.R

# Testing QueryNode
test_that("QueryNode returns correct structure for terminal node", {
  search_operator <- DefaultOperator("4HHB")
  result <- QueryNode(search_operator)
  expect_equal(result$type, "terminal")
  expect_equal(result$service, infer_search_service(search_operator))
  expect_equal(result$parameters, search_operator)
})

test_that("QueryNode returns correct structure for group node", {
  queries <- list(DefaultOperator("4HHB"), ExactMatchOperator("rcsb_entry_info.resolution_combined", "2.0"))
  query_group <- QueryGroup(queries, "AND")
  result <- QueryNode(query_group)
  expect_equal(result$type, "group")
  expect_equal(result$nodes, query_group)
})

Try the rPDBapi package in your browser

Any scripts or data that you put into this service are public.

rPDBapi documentation built on Oct. 19, 2024, 5:08 p.m.