Skip to content

Commit

Permalink
Merge branch 'new-metadata-query' of github.com:ScotGovAnalysis/RtoSQ…
Browse files Browse the repository at this point in the history
…LServer into new-metadata-query
  • Loading branch information
tomwilsonsco committed Sep 9, 2024
2 parents 28d91aa + 0b3208c commit 1cbdedd
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions tests/testthat/test-db_table_metadata.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
test_that("basic sql created correctly", {
check_sql <- glue::glue_sql(
"SELECT column_name, data_type, CHARACTER_MAXIMUM_LENGTH
"SELECT column_name, data_type, CHARACTER_MAXIMUM_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_CATALOG = 'test_db'
AND TABLE_SCHEMA = 'test_schema'
AND TABLE_NAME = 'test_tbl'")
AND TABLE_NAME = 'test_tbl'"
)

expect_equal(col_query("test_db", "test_schema", "test_tbl"),
check_sql)
expect_equal(
col_query("test_db", "test_schema", "test_tbl"),
check_sql
)
})

test_that("char col lengths", {
Expand All @@ -21,12 +24,13 @@ test_that("char col lengths", {
"test_columns_info_updated.rds"
))

expect_equal(update_col_query(col_info_init),
col_info_updated)
expect_equal(
update_col_query(col_info_init),
col_info_updated
)
})

test_that("table stats SQL ok", {

col_info_updated <- readRDS(test_path(
"testdata",
"test_columns_info_updated.rds"
Expand All @@ -38,9 +42,13 @@ test_that("table stats SQL ok", {
))


expect_equal(get_table_stats(1,
col_info_updated,
"test_schema",
"test_iris"),
check_sql)
expect_equal(
get_table_stats(
1,
col_info_updated,
"test_schema",
"test_iris"
),
check_sql
)
})

0 comments on commit 1cbdedd

Please sign in to comment.