tests/testthat/test-db_timestamp.R

test_that("db_timestamp produce consistent results", {
  for (conn in get_test_conns()) {
    ts_posix <- Sys.time()
    ts_str <- format(ts_posix)

    expect_identical(
      db_timestamp(ts_posix, conn),
      db_timestamp(ts_str, conn)
    )

    expect_identical(
      db_timestamp(ts_posix, conn = NULL),
      db_timestamp(ts_str, conn = NULL)
    )

    # Test default fallback
    expect_identical(
      db_timestamp.default(ts_posix, conn = conn),
      db_timestamp.default(ts_str, conn = conn)
    )

    connection_clean_up(conn)
  }
})

Try the SCDB package in your browser

Any scripts or data that you put into this service are public.

SCDB documentation built on Oct. 4, 2024, 1:09 a.m.