Skip to main content

Overview

VecLabs has a comprehensive test suite covering the Rust core, TypeScript SDK, Python SDK, and Solana program. The test suite includes:
  • 31 unit tests for the Rust HNSW core
  • 6 Anchor tests for the Solana program (all passing on devnet)
  • Jest tests for the TypeScript SDK
  • pytest tests for the Python SDK
  • 1 integration test for end-to-end validation
As of the latest build, 37 tests are passing across the entire codebase.

Running Rust Tests

The Rust core contains the most extensive test coverage, validating HNSW operations, distance calculations, Merkle trees, and encryption.

Unit Tests

1

Run all workspace tests

cargo test --workspace
This runs all unit tests across solvec-core and solvec-wasm crates.
2

Run tests with output

To see println! output and test details:
cargo test --workspace -- --nocapture
3

Run tests for a specific crate

cargo test -p solvec-core

Integration Tests

The integration test validates end-to-end functionality including insert, query, delete, and serialization.
1

Run the integration test

cargo test --test integration_test -- --nocapture
2

Run specific integration test

cargo test --test integration_test test_hnsw_workflow

Test Coverage by Module

The Rust test suite covers:

HNSW Operations

Insert, query, delete, layer assignment, serialization

Distance Functions

Cosine similarity, Euclidean distance, dot product

Merkle Trees

Tree generation, proof creation, verification

Encryption

AES-256-GCM encrypt/decrypt for vector data

Running TypeScript Tests

The TypeScript SDK uses Jest as its test runner.
1

Navigate to the TypeScript SDK

cd sdk/typescript
2

Install dependencies (if not already)

npm install
3

Run the test suite

npm test
4

Run tests in watch mode

For development, run tests automatically on file changes:
npm test -- --watch
5

Run tests with coverage

npm test -- --coverage

TypeScript Test Configuration

Tests are configured in package.json:
{
  "scripts": {
    "test": "jest"
  }
}

Running Python Tests

The Python SDK uses pytest for testing.
1

Navigate to the Python SDK

cd sdk/python
2

Install pytest (if not already)

pip install pytest
3

Run the test suite

pytest tests/ -v
The -v flag enables verbose output showing each test result.
4

Run with coverage

pytest tests/ --cov=solvec --cov-report=html
This generates an HTML coverage report in htmlcov/.
5

Run specific test file

pytest tests/test_collection.py -v

Python Requirements

The Python SDK requires Python 3.10+ and has the following dependencies:
  • httpx>=0.25.0
  • pydantic>=2.0.0
  • typing-extensions>=4.0.0

Running Solana Program Tests

The Anchor program tests validate on-chain functionality including collection initialization and Merkle root updates.
Solana program tests require devnet SOL. Get devnet SOL from faucet.solana.com before running tests.
1

Navigate to the program directory

cd programs/solvec
2

Run Anchor tests

anchor test
This builds the program, deploys to a local validator, and runs all tests.
3

Run tests against devnet

To test against the already deployed devnet program:
anchor test --skip-deploy
4

Run specific test

anchor test --skip-deploy -- --grep "initialize collection"

Solana Test Status

6/6 tests passing on the devnet deployment:
  • Program: 8xjQ2XrdhR4JkGAdTEB7i34DBkbrLRkcgchKjN1Vn5nP
  • Test Collection: 8iLpyegDt8Vx2Q56kdvDJYpmnkTD2VDZvHXXead75Fm7
The Anchor test suite validates:
  • Collection account initialization
  • Merkle root updates and verification
  • Authority management
  • Storage account resizing

Running All Tests

To run the complete test suite across all components:
# From repository root
cargo test --workspace && \
cargo test --test integration_test -- --nocapture && \
cd sdk/typescript && npm test && cd ../.. && \
cd sdk/python && pytest tests/ -v && cd ../.. && \
cd programs/solvec && anchor test --skip-deploy

Continuous Integration

VecLabs uses GitHub Actions for CI. The test badge shows current status: Tests

Test Performance

Test Execution Times

  • Rust unit tests: ~2-3 seconds
  • Rust integration test: ~5-8 seconds
  • TypeScript tests: ~3-5 seconds
  • Python tests: ~2-4 seconds
  • Anchor tests: ~20-30 seconds (includes validator startup)

Troubleshooting

Clean the build cache and rebuild:
cargo clean
cargo build --workspace
cargo test --workspace
Ensure you have devnet SOL and the validator is accessible:
solana config set --url devnet
solana balance
solana airdrop 2  # if balance is low
Rebuild the TypeScript SDK:
cd sdk/typescript
npm run build
npm test
Install pytest in your Python environment:
pip install pytest pytest-cov

Next Steps

Benchmarks

Run performance benchmarks to validate optimizations

Contributing

Learn how to contribute tests and features

Build docs developers (and LLMs) love