Skip to content

Commit 0c2619d

Browse files
committed
updated tests / documentation
1 parent 74fdf11 commit 0c2619d

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ Imports:
2424
cli,
2525
duckdb (>= 1.4.0)
2626
Suggests:
27-
testthat (>= 3.0.0)
27+
testthat (>= 3.0.0),
28+
dbplyr
2829
Encoding: UTF-8
2930
LazyData: true
3031
RoxygenNote: 7.3.3

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# contoso 1.2.1
2+
* fixed create_contoso_duckdb() due to error created by table name changed
3+
* updated tests
24

35
# contoso 1.2.0
46
* changed 'date' table name to 'calendar' to avoid namespace conflicts with lubridate and base packages

cran-comments.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
## R CMD check results
22

3-
0 errors ✔ | 0 warnings ✔ | 0 notes ✔
4-
* updated table name to avoid namespace conflicts with popular packages
3+
0 errors ✔ | 0 warnings ✔ | 1 note ✖
4+
* Days since last update: 1
5+
6+
* fixed error in function caused by table name change

tests/testthat/test-create_duckdb_database.R

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@
22

33
describe("create_contoso_duckdb()", {
44

5+
it("creates a DuckDB database containing all expected tables", {
56

6-
skip_if_not_installed("DBI")
7-
skip_if_not_installed("duckdb")
8-
skip_if_not_installed("dplyr")
9-
skip_if_not_installed("dbplyr")
10-
skip_on_cran()
11-
skip_on_ci()
127

13-
result <- create_contoso_duckdb(db_dir = "in_memory", size = "100K")
8+
# Create a small in-memory Contoso DuckDB instance
9+
result <- create_contoso_duckdb(
10+
db_dir = "in_memory",
11+
size = "100K"
12+
)
1413

15-
expected_names <- c("sales","product","customer","store","fx","date","orders","orderrows")
14+
# List of tables that should be present in the returned list / connection object
15+
expected_names <- c(
16+
"sales", "product", "customer", "store", "fx",
17+
"calendar", "orders", "orderrows", "con"
18+
)
1619

20+
# Verify all expected tables exist
1721
expect_true(all(expected_names %in% names(result)))
18-
expect_setequal(names(result), expected_names)
19-
20-
expect_true(all(vapply(result, inherits, logical(1), what = "tbl_lazy")))
2122

23+
# Verify no unexpected tables are present
24+
expect_setequal(names(result), expected_names)
2225
})
26+
})

0 commit comments

Comments
 (0)