test: add unit tests for LoggingInterceptor, HttpExceptionFilter, Sta… - #169
Open
yahia008 wants to merge 1 commit into
Conversation
…tsService - src/common/logging.interceptor.spec.ts (stellar-vortex-protocol#103) - verifies log message format (METHOD URL STATUS Nms) - asserts response stream passes through unchanged - confirms no log emitted on handler error - checks statusCode is read at tap time, not intercept time - src/common/http-exception.filter.spec.ts (stellar-vortex-protocol#102) - branch 1: string body → { error: string } - branch 2: validation-array body → { error: 'Validation failed', details } - branch 3: custom-shaped body passes through as-is - branch 4: object body with string message → { error: message } - branch 5: non-HttpException Error → 500, logger.error called - non-Error throw and null throw handled gracefully - src/stats/stats.service.spec.ts (stellar-vortex-protocol#101) - empty-store all-zero guard - totalVolume BigInt reduce, missing fillAmount, large precision values - avgFillTime edge cases: no fills, filledAt unset, correct rounding - fillRate divide-by-zero guard (intents.length === 0) - uniqueUsers deduplication, activeSolvers filtering
|
@yahia008 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Title:
test: add unit tests for LoggingInterceptor, HttpExceptionFilter, and StatsService
Description:
Summary
Adds missing unit test coverage for three untested modules across the codebase.
LoggingInterceptor (
src/common/logging.interceptor.spec.ts)METHOD URL STATUS NmsstatusCodeis read inside thetapcallback, not captured at intercept timeHttpExceptionFilter (
src/common/http-exception.filter.spec.ts)Tests all four distinct response-shape branches explicitly:
{ error: string }message: string[]) →{ error: "Validation failed", details: [...] }errorstring passes through as-ismessage→{ error: message }HttpExceptionerrors → 500,logger.errorcalled; non-Error throws andnullhandled gracefullyStatsService (
src/stats/stats.service.spec.ts)Covers all aggregation edge cases:
totalVolumeBigInt reduce with missingfillAmount, large precision values beyondNumber.MAX_SAFE_INTEGER, result always returned as a stringavgFillTimewith no filled intents, allfilledAtunset, correct rounding, and exclusion of intents missingfilledAtfillRatedivide-by-zero guard (intents.length === 0 → 0)uniqueUsersdeduplication via SetactiveSolversfiltering byisActive: trueCloses #101
Closes #102
Closes #103