Skip to main content

Testing Guide

Last Verified: February 2026
Each Equa repository uses a different testing framework. This guide covers how to run tests, how to write new ones, and what coverage is expected.

Testing at a Glance

RepositoryUnit FrameworkE2E FrameworkCoverage ToolRun Command
equa-webJest 26.6 + Enzyme 3.10Playwright 1.58Jest built-inyarn test
equa-serverMocha + NYCNYC (Istanbul)yarn test:api
equabot-gatewayVitestVitest (e2e config)V8 (via Vitest)pnpm test
equa-patternlibVitest + Testing LibraryV8 (via Vitest)yarn test
command-center-sotsx (built-in)Playwright 1.58npm test

equa-web Testing

Unit Tests (Jest + Enzyme)

cd ~/Documents/repos/equa-web
yarn test
  • Framework: Jest 26.6 with Enzyme 3.10 for React component testing
  • Config: jest.setup.js in project root
  • Test environment: jsdom
  • Test files: *.test.js, *.test.ts, *.test.tsx
  • Location: Colocated with source (e.g., src/shared/components/button/button.test.js)
Source: equa-web/package.json scripts and Jest config

E2E Tests (Playwright)

# Run all E2E tests
yarn test:e2e

# Run with browser UI for debugging
yarn test:e2e:ui

# Run in headed mode (visible browser)
yarn test:e2e:headed
  • Framework: Playwright 1.58
  • Config: playwright.config.ts
  • Test directory: e2e/
  • Base URL: http://localhost:8080
  • Key test files: e2e/google-auth-smoke.spec.ts, e2e/auth-modal-security.spec.ts, e2e/agreements.spec.ts
The webpack dev server starts automatically when running E2E tests. Source: equa-web/package.json scripts; .github/workflows/e2e-tests.yml

equa-server Testing

Integration Tests (Mocha)

cd ~/Documents/repos/equa-server
yarn test:api
  • Framework: Mocha with TypeScript support
  • Config: modules/api/test/.mocharc.js
  • Coverage: NYC (Istanbul)
  • Test location: modules/api/test/
Test directory structure:
modules/api/test/
├── integration/
│   ├── local/        # Tests that run against local DB
│   └── external/     # Tests against external services
├── unit/             # Unit tests (validation, hashing, etc.)
└── fixtures/         # Test data and setup helpers
Integration tests require a running PostgreSQL database. Start the Docker container first: docker-compose up -d
Source: equa-server/package.json scripts; modules/api/test/ directory structure

equabot-gateway Testing

Unit Tests (Vitest)

cd ~/Documents/repos/equabot
pnpm test
  • Framework: Vitest
  • Config: vitest.config.ts
  • Test files: Colocated *.test.ts next to source files
  • Workers: 4-16 locally, 2-3 in CI

E2E and Live Tests

# E2E tests
pnpm test:e2e

# Live tests (requires real API keys)
EQUABOT_LIVE_TEST=1 pnpm test:live

# All tests including Docker suites
pnpm test:all

Coverage Requirements

equabot-gateway is the only repo with enforced coverage thresholds:
MetricThreshold
Lines70%
Functions70%
Statements70%
Branches55%
# Run with coverage report
pnpm test:coverage
Source: equabot-gateway/vitest.config.ts coverage configuration

equa-patternlib Testing

cd ~/Documents/repos/equa-patternlib-nextjs
yarn test

# With watch mode
yarn test:watch

# With coverage
yarn test:coverage
  • Framework: Vitest with Testing Library
  • Config: vitest.config.js
  • Environment: jsdom (for React component testing)
  • Test files: Colocated *.test.tsx next to components
Source: equa-patternlib-nextjs/package.json scripts

command-center-so Testing

cd ~/Documents/repos/command-center-so
npm test
  • Framework: tsx built-in test runner (Node.js --test)
  • Test location: test/ directory
  • Test files: *.test.ts
E2E tests use Playwright:
npx playwright test
Source: command-center-so/package.json scripts

Writing a New Test

Naming Convention

RepositoryPatternLocation
equa-web*.test.ts, *.test.tsxColocated with source
equa-server*.test.tsmodules/api/test/ directory
equabot-gateway*.test.tsColocated with source
equa-patternlib*.test.tsxColocated with source
command-center-so*.test.tstest/ directory

Minimal Test Examples

Vitest (equabot-gateway, equa-patternlib):
import { describe, it, expect } from 'vitest';
import { formatTimestamp } from './format-timestamp';

describe('formatTimestamp', () => {
  it('formats ISO date string', () => {
    expect(formatTimestamp('2026-02-21T10:00:00Z')).toBe('Feb 21, 2026');
  });
});
Jest (equa-web):
import React from 'react';
import { shallow } from 'enzyme';
import { Button } from './Button';

describe('Button', () => {
  it('renders children', () => {
    const wrapper = shallow(<Button>Click me</Button>);
    expect(wrapper.text()).toContain('Click me');
  });
});
Mocha (equa-server):
import { expect } from 'chai';
import { validateEmail } from '../src/validation';

describe('validateEmail', () => {
  it('accepts valid email', () => {
    expect(validateEmail('user@example.com')).to.be.true;
  });
});

E2E Setup

Before running Playwright E2E tests for the first time, install browsers:
npx playwright install
This downloads Chromium, Firefox, and WebKit. Required for both equa-web and command-center-so. Common Playwright commands:
CommandWhat It Does
npx playwright testRun all tests headless
npx playwright test --headedRun with visible browser
npx playwright test --uiOpen interactive test runner
npx playwright test --debugRun with Playwright Inspector
npx playwright show-reportView HTML test report

Coverage

RepositoryEnforced?ThresholdsCommand
equabot-gatewayYes70% lines/functions/statements, 55% branchespnpm test:coverage
equa-webNoyarn test --coverage
equa-serverNoyarn test:api (NYC integrated)
equa-patternlibNoyarn test:coverage
command-center-soNo
Only equabot-gateway will fail CI if coverage drops below thresholds. Other repos generate coverage reports but do not enforce minimums.