tests/testthat/test-backend-factory.R

# Test `BackendFactory` class.

test_that("'BackendFactory' produces the correct instance types", {
    # Create a backend factory.
    backend_factory <- BackendFactory$new()

    # Expect a synchronous backend.
    expect_equal(
        Helper$get_class_name(backend_factory$get("sync")),
        "SyncBackend"
    )

    # Expect an asynchronous backend.
    expect_equal(
        Helper$get_class_name(backend_factory$get("async")),
        "AsyncBackend"
    )

    # Expect error for unsupported backend types.
    expect_error(
        backend_factory$get("unsupported"),
        as_text(Exception$feature_not_developed())
    )
})

Try the parabar package in your browser

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

parabar documentation built on May 29, 2024, 8:42 a.m.