Skip to content

feat: add auth tests, stream lifecycle integration tests, frontend Vitest setup, and events pagination#386

Merged
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
akintewe:feat/issues-334-335-336-337
Apr 28, 2026
Merged

feat: add auth tests, stream lifecycle integration tests, frontend Vitest setup, and events pagination#386
ogazboiz merged 1 commit into
LabsCrypt:mainfrom
akintewe:feat/issues-334-335-336-337

Conversation

@akintewe
Copy link
Copy Markdown
Contributor

Summary

  • Auth unit tests (backend/tests/auth.test.ts): 8 tests covering challenge/nonce issuance, valid-signature JWT flow, expired-nonce 401, invalid-signature 401, middleware accepts valid JWT, rejects expired JWT, rejects missing token, and SSE endpoint requires auth
  • Stream lifecycle integration tests (backend/tests/integration/streams.test.ts): covers stream_created → GET /streams/:id, stream_topped_up → depositedAmount updated, stream_paused → isPaused=true, stream_resumed → isPaused=false, stream_cancelled → isActive=false, stale-DB claimable fallback, SSE broadcast for every event type, and events endpoint pagination/eventType filter/hasMore accuracy
  • Frontend Vitest setup (frontend/vitest.config.ts + frontend/src/__tests__/): tests for formatAmount, parseAmount, formatRate, hasValidPrecision, CSV export utils, isValidStellarPublicKey, LiveCounter (ticks/stops), CancelConfirmModal (confirm/cancel callbacks, Escape key), RecipientStep, AmountStep, and useStreamEvents hook (connect, events, reconnect, clearEvents)
  • CI (.github/workflows/ci.yml): frontend test step added before build

Test plan

  • cd backend && npx vitest run — all backend tests pass (auth + integration)
  • cd frontend && npm test — all frontend tests pass
  • CI frontend job runs lint → test → build in order

closes #334 #335 #336 #337

…m events pagination

- backend/tests/auth.test.ts: 8 unit tests for challenge/verify flow and requireAuth middleware (LabsCrypt#335)
- backend/tests/integration/streams.test.ts: integration tests for stream lifecycle (created, topped_up, paused, resumed, cancelled), claimable RPC fallback, SSE broadcast, and events pagination/filtering (LabsCrypt#334)
- frontend/vitest.config.ts: Vitest config with happy-dom, React plugin, path aliases, and 80% coverage thresholds (LabsCrypt#336)
- frontend/src/__tests__/: unit tests for formatAmount/parseAmount/formatRate/hasValidPrecision, CSV export utils, isValidStellarPublicKey, LiveCounter, CancelConfirmModal, RecipientStep, AmountStep, and useStreamEvents hook (LabsCrypt#336)
- .github/workflows/ci.yml: add frontend test step to CI (LabsCrypt#336)
- Stream events endpoint already supports ?limit/offset/eventType/order per LabsCrypt#337
@ogazboiz ogazboiz merged commit 2c3e5d0 into LabsCrypt:main Apr 28, 2026
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write integration tests for full stream lifecycle via API

2 participants