Skip to content

Commit

Permalink
Test different sets of PIs per project. Closes #21.
Browse files Browse the repository at this point in the history
  • Loading branch information
mhpob committed Jun 15, 2024
1 parent dffed2e commit ea26c56
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/project_contacts.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ project_contacts <- function(extract, type = c("receiver", "tag")) {
),
by = "detectedby"
]
pis <- merge(pis[, -c("PI", "POC", "PI_emails", "POC_emails")],
pis <- merge(
pis[, -c("PI", "POC", "PI_emails", "POC_emails")],
pi_key,
on = "detectedby"
by = "detectedby"
)
pis <- unique(pis, by = "detectedby")
# maybe need to also merge their geom?
Expand Down
33 changes: 33 additions & 0 deletions tests/testthat/test-project_contacts.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,36 @@ test_that("right things are returned for receivers", {
all(grepl("@|", pi_table$POC_emails))
)
})




test_that("Multiple sets of tag PIs per project are summarized", {
matched_multiple_pis <- matched
matched_multiple_pis[matched_multiple_pis$detectedby == 'HFX',][1, 'contact_pi'] <-
c("Matthew Apostle (matt@bible), Mary Mother (mary@bible)")


pi_table <- project_contacts(matched_multiple_pis, "tag")

expect_false(
any(
duplicated(pi_table$project_name)
)
)

expect_match(
pi_table[pi_table$project_name == "HFX",]$PI,
"Matthew Apostle, Mary Mother, Dave Hebert, Fred Whoriskey"
)

expect_match(
pi_table[pi_table$project_name == "HFX",]$PI_emails,
"matt@bible,mary@bible,david.hebert@dfo-mpo.gc.ca,fwhoriskey@dal.ca"
)

})

test_that("Multiple sets of receiver PIs per project are summarized", {

})

0 comments on commit ea26c56

Please sign in to comment.