@@ -305,3 +305,42 @@ test_that("converts length one list", {
305305 hm <- ensure_column(tibble :: tibble(one = " hi" ), NA_list_ , " one" )
306306 expect_type(hm $ one , " list" )
307307})
308+
309+ test_that(" parse_connectapi handles mixed null/non-null character values" , {
310+ data <- list (
311+ list (guid = " aaa" , bundle_id = NULL , name = " first" ),
312+ list (guid = " bbb" , bundle_id = " 123" , name = " second" )
313+ )
314+
315+ result <- parse_connectapi(data )
316+ expect_s3_class(result , " tbl_df" )
317+ expect_equal(nrow(result ), 2 )
318+ expect_type(result $ bundle_id , " character" )
319+ expect_identical(result $ bundle_id , c(NA_character_ , " 123" ))
320+ })
321+
322+ test_that(" parse_connectapi handles mixed null/non-null datetime strings" , {
323+ data <- list (
324+ list (guid = " aaa" , active_time = NULL ),
325+ list (guid = " bbb" , active_time = " 2023-08-22T14:13:14Z" )
326+ )
327+
328+ result <- parse_connectapi(data )
329+ expect_s3_class(result , " tbl_df" )
330+ expect_equal(nrow(result ), 2 )
331+ expect_type(result $ active_time , " character" )
332+ expect_identical(result $ active_time , c(NA_character_ , " 2023-08-22T14:13:14Z" ))
333+ })
334+
335+ test_that(" parse_connectapi handles mixed null/non-null integer timestamps" , {
336+ data <- list (
337+ list (key = " abc" , start_time = 1732573574 , end_time = NULL ),
338+ list (key = " def" , start_time = 1732553145 , end_time = 1732556770 )
339+ )
340+
341+ result <- parse_connectapi(data )
342+ expect_s3_class(result , " tbl_df" )
343+ expect_equal(nrow(result ), 2 )
344+ expect_type(result $ end_time , " double" )
345+ expect_identical(result $ end_time , c(NA_real_ , 1732556770 ))
346+ })
0 commit comments