1
1
library(tibble )
2
2
3
- test_that(" the correct abbreviation for the register is used" , {
4
- bef_complete <- tibble(pnr = 1 , koen = 1 , foed_dato = 1 )
3
+ bef_complete <- tibble :: tibble(pnr = 1 , koen = 1 , foed_dato = 1 )
5
4
5
+ test_that(" the correct abbreviation for the register is used" , {
6
6
# When incorrect register abbreviation is given
7
7
expect_error(verify_required_variables(bef_complete , " bef1" ))
8
8
# When correct abbreviation is given
@@ -11,7 +11,6 @@ test_that("the correct abbreviation for the register is used", {
11
11
12
12
test_that(" the required variables are present in the dataset" , {
13
13
# Expected
14
- bef_complete <- tibble(pnr = 1 , koen = 1 , foed_dato = 1 )
15
14
bef_complete_extra <- tibble(pnr = 1 , koen = 1 , foed_dato = 1 , something = 1 )
16
15
bef_incomplete <- tibble(pnr = 1 , koen = 1 )
17
16
@@ -22,5 +21,34 @@ test_that("the required variables are present in the dataset", {
22
21
expect_true(verify_required_variables(bef_complete_extra , " bef" ))
23
22
24
23
# When it is a character output, it is a fail
25
- expect_character(verify_required_variables(bef_incomplete , " bef" ))
24
+ expect_type(verify_required_variables(bef_incomplete , " bef" ), " character" )
25
+ })
26
+
27
+
28
+ test_that(" verification works for DuckDB Database" , {
29
+ actual <- arrow :: to_duckdb(bef_complete ) | >
30
+ verify_required_variables(" bef" )
31
+
32
+ expect_true(actual )
33
+ })
34
+
35
+ test_that(" verification works for Arrow Tables (from Parquet)" , {
36
+ actual <- arrow :: as_arrow_table(bef_complete ) | >
37
+ verify_required_variables(" bef" )
38
+
39
+ expect_true(actual )
40
+ })
41
+
42
+ test_that(" verification works for data.frame" , {
43
+ actual <- as.data.frame(bef_complete ) | >
44
+ verify_required_variables(" bef" )
45
+
46
+ expect_true(actual )
47
+ })
48
+
49
+ test_that(" verification works for data.table" , {
50
+ actual <- data.table :: as.data.table(bef_complete ) | >
51
+ verify_required_variables(" bef" )
52
+
53
+ expect_true(actual )
26
54
})
0 commit comments