Skip to content
GuidesTesting

Testing

How to run the unit tests against in-memory fakes and the live conformance suite against real backends.

The repository has two test suites. Unit tests run against in-memory fakes and need no backend. Live tests run the same conformance suite against real providers.

Run the unit tests

bun run test

Most adapters accept any client that satisfies a structural *ClientLike interface, which lists only the methods the adapter calls. The real SDK client satisfies it, and the unit tests pass fakes. The Vectorize adapter names the cloudflare client type, so its tests build a real Cloudflare client with a fake fetch and answer the v2 HTTP API in memory. The Redis fake reads the namespace out of the query it is given and answers with the documents it holds, so the tests can assert the query string the adapter writes.

The pgvector and Supabase adapters also run against PGlite, a Postgres build for WebAssembly, inside the unit suite. test/postgres installs sql/supabase.sql into it, runs the conformance cases against both adapters, and checks that vecstore_filter_sql returns the same rows as compilePgvectorFilter for every filter in a corpus. No server or Docker is needed.

Run the live tests

Set VECSTORE_LIVE=1 and the connection variables for the providers you have:

QDRANT_URL=http://localhost:6333 \
QDRANT_API_KEY=your_qdrant_api_key \
PGVECTOR_URL=postgres://postgres:postgres@localhost:5432/postgres \
PINECONE_API_KEY=your_pinecone_api_key \
SUPABASE_URL=https://your_project_ref_here.supabase.co \
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key_here \
UPSTASH_VECTOR_REST_URL=https://your-index.upstash.io \
UPSTASH_VECTOR_REST_TOKEN=your_upstash_token \
CLOUDFLARE_ACCOUNT_ID=your_account_id_here \
CLOUDFLARE_API_TOKEN=your_api_token_here \
REDIS_URL=redis://localhost:6379 \
bun run test:live

The suite skips providers without a variable. For each provider it creates a temporary index, runs the store verbs, the record verbs, and the eq, gt, isIn, notIn, and not builders, and deletes the index. The pgvector and Supabase adapters also run on PGlite in the unit suite. QDRANT_API_KEY is optional for a local Qdrant and required for Qdrant Cloud.

Three providers ask for more. Supabase needs the SQL functions installed before the suite runs, and the service role key because the suite creates and drops tables. Upstash cannot create an index at all, so a vecstore index is a namespace inside the index your URL and token point at, and Upstash creates that namespace on the first write. Point them at a scratch index with dimension 3 and the cosine similarity function, which is what the conformance suite asks for. The Vectorize token needs the Vectorize permission, and that run skips the delete({ all: true }) case, because Vectorize has no call that empties a namespace. REDIS_URL has to point at a server that carries the query engine and JSON, such as Redis 8 or Redis Stack; the Redis run adds cases for the default namespace, exists, list fields, and delete by filter.

On this page