OUT-4084: unit tests for helper functions + small fixes - #140
Merged
Conversation
updateChannelMap returns undefined when no channel matches the where-clause, but was typed to always return a row. Callers already ignore the result. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Lets unit tests import modules that touch the Assembly SDK, whose dist does a directory import Node's ESM loader can't resolve. Mirrors the integration config. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cover normalizeError (per error-type formatting), withErrorHandler and withErrorLogging (error-to-response / logging + rethrow), and dropboxArgHeader (unicode escaping). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cover generateToken (AES round-trip + random IV), isCopilotApiError (shape acceptance and rejections incl. a Dropbox error), and HexColorSchema. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Cover getCompanySelectorValue, the sync request schemas, the Assembly webhook payload schema, and validateHandleableEvent / parseWebhook. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The DropboxResponseError branch sat after the generic Error branch, so it was dead code (DropboxResponseError extends Error with a truthy message) and Dropbox failures surfaced "Response failed with a X code" instead of error_summary. Reorder it above the Error branch, matching normalizeError. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThe PR backfills focused unit coverage for sync, webhook, Copilot, and utility helpers while correcting Dropbox error-response selection and accurately typing a potentially unmatched channel-map update.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness, security, or build failures identified. The production changes align runtime behavior with existing contracts, all channel-map update callers tolerate the optional result, and the test configuration uses a supported pattern already present in the repository. Important Files Changed
Reviews (1): Last reviewed commit: "fix(OUT-4084): surface Dropbox error_sum..." | Re-trigger Greptile |
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.
What & why
Backfills fast unit tests for pure helpers that had none, plus two small production fixes surfaced along the way.
Linear: OUT-4084
Unit tests added (~52)
normalizeError(per error-type formatting),withErrorHandler/withErrorLogging(error → response / logging + rethrow),dropboxArgHeader(unicode escaping).generateToken(AES round-trip + random IV),isCopilotApiError(shape accept + rejections incl. a Dropbox error),HexColorSchema.getCompanySelectorValue, the sync request Zod schemas, the Assembly webhook payload schema,validateHandleableEvent/parseWebhook.Production fixes
updateChannelMapreturn type widened to... | undefined(it returns undefined on no match; all callers ignore the result).withErrorHandler: reordered theDropboxResponseErrorbranch above the genericErrorbranch — it was dead code, so Dropbox failures surfaced"Response failed with a X code"instead oferror_summary. Now matchesnormalizeError. (Covered by a new test.)Test-infra
vitest.config.ts: inline@assembly-js/node-sdkin the unit config (mirrors the integration config) so unit tests can import modules that touch the Assembly SDK.Out of scope
filePathhelpers — already covered byfilePath.test.ts.withRetry— heavier setup (p-retry + Sentry + timers); deferred.Testing
pnpm typecheck✅ ·pnpm lint✅ ·pnpm test→ 256 passed ✅pnpm test:integration→ 179 passed ✅🤖 Generated with Claude Code