Comprehensive testing suite for Anchor Engine integrations and packages.
Purpose: Test the TypeScript API client library
Capabilities Tested:
-
A: Basic Operations
- Search with query
- Text ingestion
- Simple distillation
-
B: Advanced Operations
- Filtered search (buckets, scores)
- File reading with line ranges
- Graph illumination
- Pagination handling
Run:
cd packages/api-client
pnpm test
pnpm test:coverage
pnpm test:watchPurpose: Test React components for the web UI
Capabilities Tested:
-
A: Core Features
- Search page functionality
- Basic text ingestion
- Result display
-
B: Advanced Features
- Advanced search filters
- File upload/drop
- Metadata display
- Paste & Ingest (v5.0.0)
Run:
cd integrations/web-dashboard
pnpm test
pnpm test:component
pnpm test:coveragePurpose: Full integration testing with running engine
Capabilities Tested:
-
A→B: Complete Workflows
- Ingest → Search → Distill → Illuminate
- List → Read → Search
- Data persistence
-
Performance Benchmarks
- Search latency (<200ms p95)
- Concurrent request handling
- Memory efficiency
Requirements:
- Running Anchor Engine instance on
localhost:3160
Run:
# Start engine first
pnpm start
# In another terminal
pnpm test:e2eUnified test runner for all suites:
# Run all tests
pnpm test:runner
# Run specific suite
pnpm test:runner client
pnpm test:runner dashboard
pnpm test:runner e2e
# Run with coverage
pnpm test:coverage- Simple search
- Text ingestion
- Basic result display
- Single operations
- Unit tests
- Filtered search
- File operations
- Advanced UI features
- Complex workflows
- Integration tests
HTML coverage reports generated in:
packages/api-client/coverage/integrations/web-dashboard/coverage/coverage/(root, for E2E)
View in browser:
open packages/api-client/coverage/index.html
open integrations/web-dashboard/coverage/index.htmlTests run automatically on:
- Pull requests
- Pre-publish (
prepublishOnly) - Nightly builds
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: pnpm install
- run: pnpm build
- run: pnpm test:runner- Mock HTTP responses
- Simulate network delays
- Test error scenarios
- Mock
@rbalchii/anchor-client - Simulate user interactions
- Test component state
- Real engine instance
- Real API calls
- Real file system
# Engine URL (default: http://localhost:3160)
ANCHOR_API_URL=http://localhost:3160
# API key (if authentication enabled)
ANCHOR_API_KEY=your-api-key
# Test timeout (default: 30000ms)
TEST_TIMEOUT=60000import { describe, it, expect } from 'vitest';
import { AnchorClient } from '../src/index';
describe('Feature Name', () => {
const client = new AnchorClient({ baseUrl: 'http://localhost:3160' });
it('A: Should do basic operation', async () => {
const result = await client.search('test');
expect(result.results.length).toBeGreaterThan(0);
});
it('B: Should do advanced operation', async () => {
const result = await client.search('test', {
maxResults: 20,
buckets: ['inbox']
});
expect(result.results.length).toBeLessThanOrEqual(20);
});
});import { render, screen, fireEvent } from '@testing-library/react';
import { Component } from '../pages/Component';
describe('Component - A+B Tests', () => {
it('A: Should render basic UI', () => {
render(<Component />);
expect(screen.getByTestId('basic')).toBeInTheDocument();
});
it('B: Should handle advanced interaction', async () => {
render(<Component />);
fireEvent.click(screen.getByRole('button'));
expect(await screen.findByText('Success')).toBeInTheDocument();
});
});Benchmarks included in E2E tests:
- Search Latency: <200ms p95
- Concurrent Requests: 10 requests in <5s
- Memory Usage: <1GB during tests
- File Operations: <1s for 10MB files
- Check if engine is running (for E2E)
- Verify
pnpm installcompleted - Check Node.js version (v20+)
- Increase
TEST_TIMEOUTenvironment variable - Check network connectivity
- Verify engine performance
- Ensure
@vitest/coverage-v8is installed - Check vitest config has coverage section
- Run with
--coverageflag
- Visual regression testing for dashboard
- Load testing with k6
- Browser extension tests (Playwright)
- Mobile responsiveness tests
- Accessibility tests (a11y)