AI Proxy Documentation

Intelligent AI Request Router with Smart Monitoring

← Back to Home

Testing

Test strategy and coverage information for GLM Proxy.

Related:

E2E Testing with Screenshots

The project uses Playwright for E2E testing, including automated screenshot generation for documentation:

Dashboard Overview

Screenshot Generation

Generate screenshots for documentation:

npm run screenshots:generate
npm run screenshots:extract

See Screenshots Gallery for all available screenshots.

Running Tests

Run All Tests

npm test

Run with Coverage

npm run test:verbose

Test Structure

Tests are located in the test/ directory:

test/
├── circuit-breaker.test.js      # Circuit breaker logic
├── config.test.js               # Configuration handling
├── key-manager.test.js          # Key management and rotation
├── rate-limiter.test.js         # Rate limiting
├── request-handler.test.js       # Request proxy logic
├── stats-aggregator.test.js     # Metrics collection
├── circular-buffer.test.js       # Latency tracking
└── ...

Test Strategy

Unit Tests

Integration Tests

Coverage Tracking

Performance Testing: See Load Testing Guide for baseline validation and performance targets.

Current coverage status is tracked in:

Coverage Goals

Module Target Current
Core logic 90%+ TBD
Error handling 95%+ TBD
Edge cases 80%+ TBD

Writing New Tests

Test Template

describe('module-name', () => {
  beforeEach(() => {
    // Setup
  });

  afterEach(() => {
    // Teardown
  });

  test('should do something', () => {
    // Arrange
    const input = {};

    // Act
    const result = functionUnderTest(input);

    // Assert
    expect(result).toBe(expected);
  });
});

Test Quarantine

Tests that are temporarily disabled are tracked in:

Continuous Integration

Release Process: See Release Process for automated release workflow and commit conventions.

Tests run automatically on:

Debugging Tests

Run Single Test File

npm test -- path/to/test.test.js

Run Specific Test

npm test -- -t "test name pattern"

Debug Mode

NODE_ENV=test node --inspect-brk node_modules/.bin/jest --runInBand

Test Data

Test fixtures and mocks:

See Also