test: add unit tests for server handler business logic#820
Open
NewCoder3294 wants to merge 1 commit intokoala73:mainfrom
Open
test: add unit tests for server handler business logic#820NewCoder3294 wants to merge 1 commit intokoala73:mainfrom
NewCoder3294 wants to merge 1 commit intokoala73:mainfrom
Conversation
Adds tests/handlers.test.mts with 72 test cases across 14 suites covering exported pure functions from three server handler modules: - cyber/_shared.ts: clampInt, dedupeThreats, toProtoCyberThreat, enum maps - news/_shared.ts + dedup.mjs + hash.ts: deduplicateHeadlines, hashString, buildArticlePrompts - infrastructure/get-cable-health.ts: isCableRelated, parseCoordinates, matchCableByName, findNearestCable, parseIssueDate, processNgaSignals, computeHealthMap Closes koala73#181 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@NewCoder3294 is attempting to deploy a commit to the Elie Team on Vercel. A member of the Team first needs to authorize it. |
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
Adds
tests/handlers.test.mtswith 72 test cases across 14 suites covering exported pure functions from three server handler modules. This addresses the gap noted in #181 where 949 lines of tests were deleted in a migration with no replacements.Modules covered
server/worldmonitor/cyber/v1/_shared.tsclampInt,dedupeThreats,toProtoCyberThreat, enum maps (THREAT_TYPE_MAP,SOURCE_MAP,SEVERITY_MAP,SEVERITY_RANK)server/worldmonitor/news/v1/_shared.ts+dedup.mjs+server/_shared/hash.tsdeduplicateHeadlines,hashString,buildArticlePromptsserver/worldmonitor/infrastructure/v1/get-cable-health.tsisCableRelated,parseCoordinates,matchCableByName,findNearestCable,parseIssueDate,processNgaSignals,computeHealthMapNot covered (follow-up suggestions)
server/worldmonitor/military/v1/get-usni-fleet-report.tscontains many useful pure helpers (hullToVesselType,detectDeploymentStatus,extractHomePort,stripHtml,getRegionCoords,parseUSNIArticle,extractBattleForceSummary) but these are not exported. A follow-up PR should export those functions to enable unit testing.Test plan
npx tsx --test tests/handlers.test.mts)test:data) unaffected (pre-existing bootstrap test failure confirmed on main)Closes #181
🤖 Generated with Claude Code