Testing

End-to-end strategy for unit, integration, property-based, and load testing of Nostr apps.

UnitIntegrationE2ELoad

Unit Testing

Pure logic and serialization

Mock cryptography and focus on event builders, filters, and reducers.

Property-Based Testing

Generate cases instead of hand-picking

Use tools like fast-check (JS/TS) or Hypothesis (Python) to fuzz event shapes, kinds, and edge timestamps.

Integration Testing

Talk to a mock or local relay

Spin a local relay or stub server to validate subscriptions, publish, and error paths.

Fixtures & Test Data

Stable inputs for deterministic tests

Keep curated event corpora by kind and size; tag edge cases (max tags, invalid sigs, big content).

Load & Chaos

Throughput, latency, and failure drills

Scenarios

Fan-out timelines, backfills, and burst publishes.

Limits

Rate limits, queue sizes, timeouts, max payloads.

Chaos

Random disconnects and partial relay failures.