Commit graph

1 commit

Author SHA1 Message Date
sotashimozono
eb1215f10f
test: 100% coverage for errorMessage, RpcError, and isPreconditionFailed (#264)
- tests/errorMessage.test.ts (new): covers both branches of errorMessage()
  (Error instance → .message, non-Error → String()) and both branches of
  asError() (Error passthrough, non-Error wrapping), including subclasses,
  null, undefined, and numeric inputs.

- tests/RpcError.test.ts (new): covers RpcError constructor (name/code/
  message/data set correctly, optional data omitted), instanceof Error,
  and is() true/false branches with close numeric codes.
  Also bundles isPreconditionFailed() from src/proto/rpcError.ts: all
  branches tested — PreconditionFailed match, wrong code, missing code
  property, null, string/number primitives, and duck-typed plain object.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-09 22:07:04 +09:00