electric-sql / electric-sql/electric

Skill: Testing Electric apps (unit + integration)

Open
#3,915 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10.4k
Forks
375
Avg merge
3d 1h
Merged PRs (30d)
18

Description

## Context

Testing Electric apps requires different strategies for unit tests (mocked fetch) vs integration tests (real Electric server + Postgres). The integration test setup involves Docker, multiple services, and specific configuration.

## Scope

Create an `electric-testing` skill covering:

1. **Unit testing** — Mocking `fetchClient` with `vi.fn()`, testing collection behavior without network
2. **Integration test setup** — Docker Compose for Postgres + Electric + nginx, port configuration
3. **Building local Electric image** — When to use canary vs local build
4. **Test database management** — Schema setup, teardown, test isolation
5. **Testing patterns** — Testing optimistic mutations, testing live query reactivity, testing error recovery
6. **CI configuration** — GitHub Actions / similar with Electric services

## Source

Identified during domain discovery skill test run. Integration test setup is a distinct developer task with non-trivial infrastructure.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.