runAdapterContract

tagtree · /core·function

Registers a Vitest describe block that verifies an adapter implementation satisfies the CacheAdapter contract; call this inside each adapter package's own test suite to catch behavioral regressions without duplicating test logic.

Signature

@nordcom/commerce-tagtree

Parameters

NameTypeDescription
optsContractTestOptions

Example

import { runAdapterContract } from '@tagtree/core/contract-tests';
import { memoryAdapter } from '@tagtree/core';

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

ContractTestOptions AdapterCtx CacheAdapter CacheInstance CacheKey CacheSchema CacheSchemaShape EntityDecl

On this page