Test Coverage
Detailed breakdown of test coverage across all components of Clear AI v2.
Summary
Metric | Value |
---|---|
Total Tests | 960+ |
Overall Pass Rate | 97% |
Code Coverage | 93.2% |
Test Files | 69 |
Test Suites | ~45 |
Coverage by Layer
Shared Library (19 Modules)
724 Unit Tests + 100+ Integration Tests
Module | Unit Tests | Integration Tests | Pass Rate |
---|---|---|---|
Conversational AI | |||
- Response System | 25 | 8 | 100% |
- Intent Classification | 18 | 5 | 100% |
- Confidence Scoring | 15 | 3 | 100% |
- Progress Tracking | 20 | 2 | 100% |
- Conversation Utilities | 14 | 2 | 100% |
Context & Memory | |||
- Context Management | 45 | 12 | 100% |
- Compression | 35 | 5 | 100% |
- Memory Systems | 32 | 15 | 92% |
Workflows | |||
- Workflow Graphs | 18 | 8 | 100% |
- Checkpointing | 17 | 2 | 100% |
Infrastructure | |||
- Token Management | 28 | 5 | 100% |
- LLM Providers | 15 | 12 | 92% |
- Configuration | 18 | 3 | 100% |
- Observability | 12 | 5 | 100% |
Foundation | |||
- Types | 50 | - | 100% |
- Validation | 88 | 5 | 100% |
- Utilities | 185 | 8 | 100% |
- Tools (MCP) | 44 | - | 100% |
- API (REST) | 52 | - | 100% |
Subtotal | 724 | 100+ | 98% |
Agent System (5 Agents)
78 Unit Tests + 102 Integration Tests
Agent | Unit Tests | Integration Tests | Pass Rate |
---|---|---|---|
Planner | 18 | 24 | 100% |
Executor | 21 | 15 | 100% |
Analyzer | 18 | 12 | 100% |
Summarizer | 8 | 11 | 100% |
Orchestrator | 13 | 16 | 100% |
System E2E | - | 20 | 100% |
Subtotal | 78 | 102 | 100% |
GraphQL API
62 Integration Tests
Test Suite | Tests | Passing | Pass Rate |
---|---|---|---|
Server Integration | 12 | 11 | 92% |
Query Resolvers | 18 | 18 | 100% |
Mutation Resolvers | 17 | 17 | 100% |
Subscription Resolvers | 15 | 14 | 93% |
Subtotal | 62 | 60 | 97% |
Code Coverage Report
Overall Coverage
File | % Stmts | % Branch | % Funcs | % Lines |
----------------------|---------|----------|---------|---------|
All files | 93.2 | 84.7 | 95.8 | 93.2 |
By Component
Agents:
agents/
planner.ts | 95.2 | 87.5 | 100 | 95.2 |
executor.ts | 93.8 | 85.0 | 100 | 93.8 |
analyzer.ts | 91.5 | 82.3 | 95.5 | 91.5 |
summarizer.ts | 89.7 | 78.9 | 91.7 | 89.7 |
orchestrator.ts | 96.3 | 90.1 | 100 | 96.3 |
GraphQL:
graphql/
server.ts | 88.5 | 75.0 | 91.7 | 88.5 |
resolvers.ts | 92.1 | 83.3 | 94.4 | 92.1 |
schema.ts | 100 | 100 | 100 | 100 |
Shared Library:
shared/
llm/provider.ts | 92.1 | 85.7 | 94.4 | 92.1 |
memory/manager.ts | 88.5 | 76.4 | 88.9 | 88.5 |
context/manager.ts | 94.7 | 88.2 | 96.3 | 94.7 |
workflow/executor.ts| 91.3 | 82.1 | 93.5 | 91.3 |
Tools:
tools/
shipments.ts | 96.8 | 91.7 | 100 | 96.8 |
facilities.ts | 95.2 | 89.3 | 97.8 | 95.2 |
contaminants.ts | 94.1 | 87.5 | 96.5 | 94.1 |
inspections.ts | 93.7 | 86.2 | 95.8 | 93.7 |
Test Execution Times
Unit Tests
Component Tests Time
─────────────────────────────────────────
Shared Library (724 tests) 724 8.5s
Agent Unit Tests (78 tests) 78 2.1s
─────────────────────────────────────────
Total Unit Tests 802 10.6s
Integration Tests
Component Tests Time
──────────────────────────────────────────────
Agent Integration Tests 102 95.2s
GraphQL Tests 62 2.2s
LLM Provider Tests 12 18.4s
Memory System Tests 15 22.1s
Other Integration Tests 13 15.8s
──────────────────────────────────────────────
Total Integration Tests 160+ 153.7s (2.6 min)
Complete Test Suite
Total Time: ~164s (2.7 minutes)
Test Quality Metrics
Reliability
- Flaky Test Rate: < 1% (deterministic)
- False Positive Rate: ~2% (2 GraphQL test mock issues)
- Test Stability: 99%+ (consistent results)
Coverage Gaps
Areas with Lower Coverage (< 90%):
-
Memory Systems (88.5%)
- Reason: Requires Neo4j/Pinecone services
- Mitigation: Mock-based tests, integration tests optional
-
Observability (85-90%)
- Reason: Requires Langfuse service
- Mitigation: Integration tests skipped when service unavailable
-
Subscription Edge Cases (93%)
- Reason: WebSocket timing complexity
- Mitigation: Known issues documented, functional code verified
High-Value Coverage
Critical Paths with 100% Coverage:
- ✅ All agent business logic
- ✅ Query planning and validation
- ✅ Plan execution and dependency resolution
- ✅ Tool parameter resolution
- ✅ Error handling and retries
- ✅ GraphQL query and mutation resolvers
Test Maintenance
Adding New Tests
# Create test file
touch src/tests/my-module/my-feature.test.ts
# Write test
# Run to verify
yarn test src/tests/my-module/my-feature.test.ts
# Run all tests
yarn test
Updating Existing Tests
# Make changes
vim src/tests/agents/planner.test.ts
# Run affected tests
yarn test planner
# Verify coverage maintained
yarn test:coverage
Test Data Fixtures
Located in src/tests/fixtures/
:
waste-data.ts
- Mock waste management datamemory-mocks.ts
- Memory system mocksshared-test-data.ts
- Shared test utilities
Continuous Integration
GitHub Actions
on: [push, pull_request]
jobs:
unit-tests:
# Fast feedback (~15s)
run: yarn test
integration-tests:
# Thorough validation (~3 min)
run: yarn test:integration
graphql-tests:
# API layer validation (~2s)
run: npx jest src/tests/graphql
Coverage Reporting
# Generate coverage report
yarn test:coverage
# View in browser
open coverage/lcov-report/index.html
# CI uploads to Codecov (if configured)
Coverage Goals
Current
- Unit Tests: 93.2% coverage
- Integration Tests: 97% pass rate
- Overall: 960+ tests
Target
- Unit Tests: 95% coverage
- Integration Tests: 99% pass rate
- Agent Tester: 200+ scenarios
Related Documentation
- Testing Overview - Testing strategy
- Agent Tester - Scenario-based testing
- Agent Testing Guide - Detailed examples
- Development Guide - Writing tests