Skip to main content
Version: Next

TestCaches

Home > @backstage/backend-test-utils > TestCaches

Encapsulates the creation of ephemeral test cache instances for use inside unit or integration tests.

Signature:

class TestCaches 

Methods

MethodModifiersDescription
create(options)static

Creates an empty TestCaches instance, and sets up Jest to clean up all of its acquired resources after all tests finish.

You typically want to create just a single instance like this at the top of your test file or describe block, and then call init many times on that instance inside the individual tests. Spinning up a "physical" cache instance takes a considerable amount of time, slowing down tests. But wiping the contents of an instance using init is very fast.

eachSupportedId()
init(id)Returns a fresh, empty cache for the given driver.
setDefaults(options)static
supports(id)