Skip to content

Commit

Permalink
Cleaned up invalid test
Browse files Browse the repository at this point in the history
  • Loading branch information
azimov committed Feb 28, 2025
1 parent 94b0787 commit c3d9198
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions tests/testthat/test-1-ResultsDataModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ VALUES ('Synthea','Synthea','OHDSI Community','SyntheaTM is a Synthetic Patient

test_that("Sqlite results data model", {
dbFile <- tempfile(fileext = ".sqlite")
expect_error(createMergedResultsFile(dataFolder = file.path(folder, "export"),
expect_error(createMergedResultsFile(dataFolder = file.path("non_existant_export_folder"),
sqliteDbPath = dbFile,
overwrite = TRUE,
tablePrefix = "cd_"))
Expand All @@ -192,27 +192,5 @@ test_that("Sqlite results data model", {
connectionDetails = connectionDetailsSqlite,
databaseSchema = "non_existant_schema"
))

specifications <- getResultsDataModelSpecifications()
for (tableName in unique(specifications$tableName)) {
primaryKey <- specifications %>%
dplyr::filter(tableName == !!tableName &
primaryKey == "Yes") %>%
dplyr::select("columnName") %>%
dplyr::pull()

if ("database_id" %in% primaryKey) {
sql <-
"SELECT COUNT(*) FROM @schema.@table_name WHERE database_id = '@database_id';"
sql <- SqlRender::render(
sql = sql,
schema = "main",
table_name = paste0("cd_", tableName),
database_id = "cdmv5"
)
databaseIdCount <- DatabaseConnector::querySql(connectionSqlite, sql)[, 1]
expect_true(databaseIdCount >= 0)
}
}
})
})

0 comments on commit c3d9198

Please sign in to comment.