`exportManager$exportDataFrame(df2, "table1", append = TRUE)` did not throw the expected error.

test_that("Test result export manager methods", {
# Create a dummy table specification and set the export directory
on.exit(unlink(export_dir, recursive = TRUE, force = TRUE))
exportManager <- createResultExportManager(tableSpecification = table_spec, exportDir = export_dir)
# Test that the properties are set correctly
expect_false(exportManager$checkPrimaryKeys(data.frame(col1 = NA, col2 = "foo"), "table1"))
expect_false(exportManager$checkPrimaryKeys(data.frame(col1 = c(1, 2, 1), col2 = "foo"), "table1"))
test_that("exportDataFrame method exports data frame correctly", {
skip_if(.Platform$OS.type == "unix" && Sys.info()["sysname"] == "Darwin", "skipping on osx")
# Check that the file is created and contains the correct data
dfR <- readr::read_csv(output_file, , show_col_types = FALSE)
exportManager$exportDataFrame(df2, "table1", append = TRUE)
dfR <- readr::read_csv(output_file, show_col_types = FALSE)
expect_error(exportManager$exportDataFrame(df2, "table1", append = TRUE), "Cannot write data - primary keys already written to cache")
expect_error(exportManager$exportDataFrame(df2, "table999", append = TRUE), "Table not found in specifications")
testDbExport <- function(connectionDetails, schema, n = 100) {
columnName = c("row_id", "value", "p_count"),
bigData <- data.frame(row_id = 1:n, value = stats::runif(n), p_count = 3)
DatabaseConnector::insertTable(conn, data = bigData, tableName = "big_table", databaseSchema = schema)
on.exit(unlink(exportDir, recursive = TRUE, force = TRUE))
exportManager <- createResultExportManager(tableSpecification = table_spec, exportDir = exportDir, minCellCount = 5)
transformFunc <- function(rows, pos, test) {
sql = "SELECT * FROM @schema.big_table",
result <- readr::read_csv(output_file, show_col_types = FALSE)
testDbC <- DatabaseConnector::createConnectionDetails(dbms = "sqlite", server = ":memory:")
testDbExport(testDbC, schema = "main", n = 1e5)

"exportDataFrame method exports data frame correctly"
"Cannot write data - primary keys already written to cache"

exportDataFrame method exports data frame correctly