-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed unit tests to anticipate connexion errors
- Loading branch information
1 parent
8a304ce
commit 4304fe2
Showing
29 changed files
with
319 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov contacts downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
jsonlite::fromJSON(version$contacts_data)$label[1], | ||
"Central Contact Person:" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
jsonlite::fromJSON(version$contacts_data)$label[1], | ||
"Central Contact Person:" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov criteria downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$criteria, | ||
jsonlite::toJSON("Inclusion Criteria (MCI patients):\n\nright handedness\namnestic and amnestic plus MCI with:\nsubjective memory impairment;\nobjective memory difficulties, at least 1 SD below gender, age and education adjusted standard values;\nrelatively normal performance in other cognitive domains;\nno constraints in activities of daily livings\nage: 50-80 years\n\nExclusion Criteria:\n\nsevere internal or psychiatric disease\nepilepsy\nother severe neurological diseases, e.g. previous major stroke or brain tumor\nDMS-IV manifest dementia\ncontraindication for MRT (claustrophobia, metallic implants, tattoos)") | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$criteria, | ||
jsonlite::toJSON("Inclusion Criteria (MCI patients):\n\nright handedness\namnestic and amnestic plus MCI with:\nsubjective memory impairment;\nobjective memory difficulties, at least 1 SD below gender, age and education adjusted standard values;\nrelatively normal performance in other cognitive domains;\nno constraints in activities of daily livings\nage: 50-80 years\n\nExclusion Criteria:\n\nsevere internal or psychiatric disease\nepilepsy\nother severe neurological diseases, e.g. previous major stroke or brain tumor\nDMS-IV manifest dementia\ncontraindication for MRT (claustrophobia, metallic implants, tattoos)") | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov enrolment downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$enrol, | ||
"22 [Anticipated]" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$enrol, | ||
"22 [Anticipated]" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov gender-based downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT05306145", 1) | ||
expect_equal( | ||
version$gender_based, | ||
"Yes" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$gender_based, | ||
"Yes" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov maximum age downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$max_age, | ||
"80" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$max_age, | ||
"80" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov minimum age downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$min_age, | ||
"50" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$min_age, | ||
"50" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov outcome measures downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
jsonlite::fromJSON(version$om_data)$content[1], | ||
"Performance in LOCATO task (Visual-spatial learning and memory) after a combination of intensive visual-spatial training and tDCS\n[ Time Frame: immediately after end of a 3-day period of training in tDCS condition vs sham condition ]\n\nInvestigation whether the combination of intensive visual-spatial training (LOCATO task) and tDCS leads to improvement of visual-spatial learning and memory measured by performance in LOCATO task after end of a 3 day period of training compared to sham stimulation." | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
jsonlite::fromJSON(version$om_data)$content[1], | ||
"Performance in LOCATO task (Visual-spatial learning and memory) after a combination of intensive visual-spatial training and tDCS\n[ Time Frame: immediately after end of a 3-day period of training in tDCS condition vs sham condition ]\n\nInvestigation whether the combination of intensive visual-spatial training (LOCATO task) and tDCS leads to improvement of visual-spatial learning and memory measured by performance in LOCATO task after end of a 3 day period of training compared to sham stimulation." | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov overall status downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$ostatus, | ||
"Recruiting" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$ostatus, | ||
"Recruiting" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov primary completion date downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$pcdate, | ||
"2015-08-01" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$pcdate, | ||
"2015-08-01" | ||
) | ||
} | ||
}) |
15 changes: 11 additions & 4 deletions
15
tests/testthat/test-clinicaltrials_gov_version_pcdate_precision.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov primary completion date precision downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$pcdate_precision, | ||
"month" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$pcdate_precision, | ||
"month" | ||
) | ||
} | ||
}) |
15 changes: 11 additions & 4 deletions
15
tests/testthat/test-clinicaltrials_gov_version_pcdatetype.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov primary completion date type downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$pcdatetype, | ||
"Anticipated" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$pcdatetype, | ||
"Anticipated" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov sex downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$sex, | ||
"All" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$sex, | ||
"All" | ||
) | ||
} | ||
}) |
15 changes: 11 additions & 4 deletions
15
tests/testthat/test-clinicaltrials_gov_version_sponsor_data.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov contacts downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
jsonlite::fromJSON(version$sponsor_data)$content[1], | ||
"Charite University, Berlin, Germany" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
jsonlite::fromJSON(version$sponsor_data)$content[1], | ||
"Charite University, Berlin, Germany" | ||
) | ||
} | ||
}) |
15 changes: 11 additions & 4 deletions
15
tests/testthat/test-clinicaltrials_gov_version_startdate.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov start date downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$startdate, | ||
"2014-03-01" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$startdate, | ||
"2014-03-01" | ||
) | ||
} | ||
}) |
15 changes: 11 additions & 4 deletions
15
tests/testthat/test-clinicaltrials_gov_version_startdate_precision.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov start date precision downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$startdate_precision, | ||
"month" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$startdate_precision, | ||
"month" | ||
) | ||
} | ||
}) |
15 changes: 11 additions & 4 deletions
15
tests/testthat/test-clinicaltrials_gov_version_volunteers.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("ClinicalTrials.gov 'accepts healthy volunteers' downloads correctly", { | ||
version <- clinicaltrials_gov_version("NCT02110043", 1) | ||
expect_equal( | ||
version$accepts_healthy_volunteers, | ||
"No" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$accepts_healthy_volunteers, | ||
"No" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("DRKS closing date downloads correctly", { | ||
version <- drks_de_version("DRKS00004013", 7) | ||
expect_equal( | ||
version$closingdate, | ||
"2014-09-01" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$closingdate, | ||
"2014-09-01" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("DRKS contacts download correctly", { | ||
version <- drks_de_version("DRKS00005219", 1) | ||
expect_equal( | ||
jsonlite::fromJSON(version$contacts)$label[1], | ||
"Primary Sponsor" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
jsonlite::fromJSON(version$contacts)$label[1], | ||
"Primary Sponsor" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("DRKS enrolment number downloads correctly", { | ||
version <- drks_de_version("DRKS00004013", 7) | ||
expect_equal( | ||
version$enrolno, | ||
"300" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$enrolno, | ||
"300" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("DRKS enrolment type downloads correctly", { | ||
version <- drks_de_version("DRKS00005219", 1) | ||
expect_equal( | ||
version$enroltype, | ||
"Actual" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
version$enroltype, | ||
"Actual" | ||
) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
test_that("DRKS inclusion criteria download correctly", { | ||
version <- drks_de_version("DRKS00005219", 1) | ||
expect_equal( | ||
jsonlite::fromJSON(version$exclusion_criteria)[2], | ||
"- Known hypersensitivity to the study medication\n- All contraindications to the study medication: arrhythmia, hyperthyroidism , glaucoma , pheochromocytoma , congestive heart failure , diabetes mellitus, known liver and kidney dysfunction, vascular disease , angina, haemodynamically significant congenital heart disease , cardiomyopathy , myocardial infarction, channelopathies, arterial hypertension , cerebrovascular diseases , such as cerebral aneurysm , vascular abnormalities , including vasculitis and stroke.\n- Participation in other clinical trials during or within one month prior to this clinical trial\n- Medical or psychological circumstances that may endanger the proper conduct of the trial\n- Existing serious somatic diseases, even if they are not covered by the contraindications according to product information\n- Existing psychiatric disorders and psychiatric disorders in prehistory\n- Smoker or ex-smoker for less than 5 years\n- Regular caffeine consumption > 4 cups per day\n- Subjects with irregular day -night rhythm (eg shift workers )\n- Unwillingness to the storage and disclosure of pseudonymous data as part of the clinical trial\n- Accommodation in an institution by court or administrative order (according to AMG § 40 (1) 4 )\n- MR contraindications ( eg pacemakers , metallic or electronic implants , metallic splinters , tinnitus, surgical clips )\n" | ||
) | ||
if (version[1] == "Error") { | ||
expect_equal( | ||
version[1], | ||
"Error" | ||
) | ||
} else { | ||
expect_equal( | ||
jsonlite::fromJSON(version$exclusion_criteria)[2], | ||
"- Known hypersensitivity to the study medication\n- All contraindications to the study medication: arrhythmia, hyperthyroidism , glaucoma , pheochromocytoma , congestive heart failure , diabetes mellitus, known liver and kidney dysfunction, vascular disease , angina, haemodynamically significant congenital heart disease , cardiomyopathy , myocardial infarction, channelopathies, arterial hypertension , cerebrovascular diseases , such as cerebral aneurysm , vascular abnormalities , including vasculitis and stroke.\n- Participation in other clinical trials during or within one month prior to this clinical trial\n- Medical or psychological circumstances that may endanger the proper conduct of the trial\n- Existing serious somatic diseases, even if they are not covered by the contraindications according to product information\n- Existing psychiatric disorders and psychiatric disorders in prehistory\n- Smoker or ex-smoker for less than 5 years\n- Regular caffeine consumption > 4 cups per day\n- Subjects with irregular day -night rhythm (eg shift workers )\n- Unwillingness to the storage and disclosure of pseudonymous data as part of the clinical trial\n- Accommodation in an institution by court or administrative order (according to AMG § 40 (1) 4 )\n- MR contraindications ( eg pacemakers , metallic or electronic implants , metallic splinters , tinnitus, surgical clips )\n" | ||
) | ||
} | ||
}) |
Oops, something went wrong.