test: add comprehensive test coverage for untested modules#225
Draft
test: add comprehensive test coverage for untested modules#225
Conversation
- Add networking/utils.test.ts: isAllowedPeer, isPeerLocalHostname, port constants - Add StatsPulseHistory.test.ts: pulse recording, totals, timestamps, immutability - Add RequestManager.test.ts: register/resolve/close, timeouts, nonce sequencing - Add storage/FSMap.test.ts: CRUD, persistence, iteration, getOrInsert variants - Add networking/udp/helpers.test.ts: handleAwaiter, handleInvalidUsernameError, tryDecodeMessage, tryParseError - Extend log.test.ts: formatBytes, formatUptime, truncateAddress, exceptionFromContext, logContext - Extend DHT.test.ts: BinaryString, BinaryHex, BaseMessage, ErrorMessage, QueryMessage schemas - Extend versioning.test.ts: parseHydrabaseUserAgent and compareVersions edge cases Total: 218 tests pass (up from 84) Agent-Logs-Url: https://github.com/QuixThe2nd/Hydrabase/sessions/e7003268-2ac4-468e-b4ae-dc4fbca36f8d
Copilot created this pull request from a session on behalf of
QuixThe2nd
April 3, 2026 08:47
View session
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
This PR significantly improves test coverage by adding new test files for previously untested modules and extending existing test files with additional edge cases.
Before: 84 passing tests across 5 files
After: 218 passing tests across 10 files
New Test Files
src/backend/networking/utils.test.ts—isAllowedPeer,isPeerLocalHostname, andPEER_PORT_MIN/MAXconstants (port range policy, localhost exemption)src/backend/StatsPulseHistory.test.ts— Pulse recording, DL/UL totals, timestamp validity, partial connection data, immutablegetHistory()copysrc/backend/RequestManager.test.ts— Register/resolve/close lifecycle, nonce sequencing, timeout behavior, average latency tracking, double-resolve protectionsrc/backend/storage/FSMap.test.ts— CRUD operations, disk persistence, iteration (keys,values,entries,forEach),getOrInsert,getOrInsertComputed, cross-instance persistencesrc/backend/networking/udp/helpers.test.ts—handleAwaiter(matching, non-matching, done/not-done),handleInvalidUsernameError(various malformed inputs),tryDecodeMessage,tryParseErrorExtended Test Files
src/utils/log.test.ts— AddedformatBytes,formatUptime,truncateAddress,exceptionFromContext,logContexttestssrc/backend/protocol/DHT.test.ts— AddedBinaryString,BinaryHex,BaseMessage,ErrorMessage,QueryMessageschema validation testssrc/backend/versioning.test.ts— Added edge cases: empty string, separator at boundaries, whitespace trimming, deep branch names, v-prefix on both sidesValidation