Skip to content

Latest commit

 

History

History
95 lines (69 loc) · 1.88 KB

File metadata and controls

95 lines (69 loc) · 1.88 KB

Testing

Quick Reference

What Command
All tests (Rust + Frontend) make test
Frontend only pnpm test:unit
Frontend watch mode pnpm test:watch
Frontend with coverage pnpm test:coverage
Rust only make test-backend
Specific frontend test pnpm test:unit <pattern>
Specific Rust test cd src-tauri && cargo test <name>

Frontend Tests

Stack: Vitest + React Testing Library

Location: src/**/*.{test,spec}.{ts,tsx}

Setup: src/test-utils/setup.ts

Example:

# Run tests matching "QueryPanel"
pnpm test:unit QueryPanel

# Watch mode for a specific file
pnpm test:watch src/components/QueryPanel

Rust Tests

Unit tests: src-tauri/src/**/*.rs (inline #[cfg(test)] modules)

Integration tests: src-tauri/tests/

Example:

cd src-tauri

# Run a specific test function
cargo test test_connection

# Run a specific integration test file
cargo test --test integration_test_name

Database Testing

Docker Compose provides test databases:

# Start containers and seed all databases
make setup

# Or step by step:
make docker-up       # Start containers
make seed-all        # Seed all databases
make seed-postgres   # Seed PostgreSQL only
make seed-mysql      # Seed MySQL only

Test Databases (via make setup):

  • PostgreSQL: localhost:15432
  • MySQL: localhost:13306
  • SQLite: seeds/sqlite/query_pilot_test.db
  • SQL Server: localhost:11435
  • Oracle: localhost:11521

See Dev Database Setup for credentials.

SSH Tunnel Tests

Requires Docker:

make test-ssh-full

Verification After Changes

After React/TypeScript changes:

pnpm typecheck && pnpm lint

After Rust changes:

cd src-tauri && cargo clippy

Before committing:

pnpm lint && pnpm typecheck && make test