ContractTestOptions

tagtree · /core·interface

Configuration passed to runAdapterContract; declares how to create and tear down the adapter under test and which optional protocol features the adapter supports.

Properties

create
() => CacheAdapter | Promise<CacheAdapter>
Factory that returns a fresh adapter instance for each individual test case.
name
string
Label used in the Vitest ``describe`` block to identify the adapter under test.
supportsStalenessGuard?
boolean
Set to ``true`` if the adapter honors ``WriteOpts.writeIfNewerThan``; enables the staleness-guard suite.
supportsTtl?
boolean
Set to ``true`` if the adapter enforces TTL-based expiry; enables the TTL test suite.
teardown?
(a: CacheAdapter) => void | Promise<void>
Optional cleanup hook called after each test to release adapter resources such as connections.

Example

runAdapterContract({
    name: 'memory',
    create: () => memoryAdapter(),
    supportsTtl: true,
    supportsStalenessGuard: true,
});

runAdapterContract AdapterCtx CacheAdapter CacheInstance CacheKey CacheSchema CacheSchemaShape EntityDecl

On this page