Skip to content

Commit d15b78c

Browse files
committed
test chaining
1 parent 7c0e0a6 commit d15b78c

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

r/adbcdrivermanager/tests/testthat/test-async.R

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,28 @@ test_that("async adbc_execute_query() promises/later integration can error", {
135135
later_loop_wait(loop)
136136
expect_true(async_called)
137137
})
138+
139+
test_that("execute_query and get_next promises can be chained", {
140+
skip_if_not_installed("later")
141+
skip_if_not_installed("promises")
142+
143+
db <- adbc_database_init(adbc_driver_monkey())
144+
con <- adbc_connection_init(db)
145+
input <- data.frame(x = 1:5)
146+
stmt <- adbc_statement_init(con, input)
147+
148+
loop <- later::create_loop()
149+
async_called <- FALSE
150+
151+
later::with_loop(loop, {
152+
adbc_statement_execute_query_promise(stmt)$then(function(x) {
153+
adbc_array_stream_get_next_promise(x)
154+
})$then(function(x) {
155+
async_called <<- TRUE
156+
expect_identical(nanoarrow::convert_array(x), input)
157+
})
158+
159+
later_loop_wait()
160+
expect_true(async_called)
161+
})
162+
})

0 commit comments

Comments
 (0)