feat: add auth tests, stream lifecycle integration tests, frontend Vitest setup, and events pagination#386
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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 authbackend/tests/integration/streams.test.ts): coversstream_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 accuracyfrontend/vitest.config.ts+frontend/src/__tests__/): tests forformatAmount,parseAmount,formatRate,hasValidPrecision, CSV export utils,isValidStellarPublicKey,LiveCounter(ticks/stops),CancelConfirmModal(confirm/cancel callbacks, Escape key),RecipientStep,AmountStep, anduseStreamEventshook (connect, events, reconnect, clearEvents).github/workflows/ci.yml): frontend test step added before buildTest plan
cd backend && npx vitest run— all backend tests pass (auth + integration)cd frontend && npm test— all frontend tests passcloses #334 #335 #336 #337