Skip to content

Add validateAddress method#1

Merged
freshlogic merged 9 commits into
mainfrom
add-validate-address
May 12, 2026
Merged

Add validateAddress method#1
freshlogic merged 9 commits into
mainfrom
add-validate-address

Conversation

@farhatraiyan
Copy link
Copy Markdown
Collaborator

Summary

  • Add validateAddress(addressValidationRequest, options) method that calls FedEx Address Validation API (POST /address/v1/addresses/resolve)
  • Same passthrough pattern as rateAndTransitTimes — caller supplies full request body, package forwards verbatim
  • Same error handling, timeout, and customer_transaction_id header support
  • Integration + mocked tests, README docs, updated package metadata

Test plan

  • CI passes all 18 tests (integration + mocked)
  • validateAddress returns output.resolvedAddresses[] for valid address
  • Non-2xx responses throw HttpError
  • 200 with errors[] envelope throws HttpError
  • customer_transaction_id option sent as x-customer-transaction-id header

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@coveralls
Copy link
Copy Markdown

coveralls commented May 12, 2026

Coverage Report for CI Build 25762347439

Coverage remained the same at 100.0%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 45 of 45 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 143
Covered Lines: 143
Line Coverage: 100.0%
Relevant Branches: 22
Covered Branches: 22
Branch Coverage: 100.0%
Branches in Coverage %: Yes
Coverage Strength: 10.37 hits per line

💛 - Coveralls

farhatraiyan and others added 2 commits May 12, 2026 13:53
Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
freshlogic and others added 6 commits May 12, 2026 14:55
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Tightens the prior business test from !== 'RESIDENTIAL' to === 'BUSINESS'
and adds explicit tests for MIXED, UNKNOWN, and a non-deliverable
address that should return Resolved: false.

MIXED uses 75 Spring St NY 10012 (SoHo apartments-over-retail) and
UNKNOWN uses 1 Crow Heart Rd, Crowheart WY 82512 — both are best
guesses; swap if FedEx classifies otherwise.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Integration tests against the FedEx sandbox can't pin classification
or attributes.Resolved — the sandbox stubs both to UNKNOWN / undefined.

Collapses the five integration classification tests to a single live
sanity check and adds five mocked tests, each inlining the exact
production response captured from apis.fedex.com:

- residential (5132 W Altgeld St, Chicago) -> classification: RESIDENTIAL, Resolved: 'true'
- business (1950 Parker Rd, Carrollton)    -> classification: BUSINESS,    Resolved: 'true'
- mixed (75 Spring St, NY)                 -> classification: MIXED,       Resolved: 'true'
- unknown (1 Crow Heart Rd, Crowheart WY)  -> classification: UNKNOWN,     Resolved: 'true'
- unresolved (9999 Imaginary Way, Chicago) -> classification: UNKNOWN,     Resolved: 'false'

Reveals a discrepancy with the fulfillment-service test fixture:
production returns attributes.Resolved as a STRING ('true'/'false'),
not a boolean. The fulfillment-service fixture has Resolved: true
(boolean); canShip's gate (Resolved !== false) never fires because
'false' !== false is always true.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Removes mockOAuthResponse, shipment, rateRequest, and the custom retry
helper. Each test now inlines its own OAuth response and rate-request
body, and async.retry replaces the bespoke retry function. MOCK_URL is
gone too -- mocked tests no longer pass url:, so the FedEx default
applies, and the mock fetch intercepts before any network call.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
async.retry treats a plain () => fn() as a callback-style task (with
arity 0, so it never gets a callback to call back) and the returned
Promise never resolves. Marking the arrow async makes async.retry
detect it as promise-returning and wait on the result.

This is what stalled the prior CI run for 18 minutes before being
cancelled.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds CHANGELOG.md (modeled on @stores.com/http-error) covering 0.1.0
and 0.2.0. Reorders subtests within each test() block alphabetically
to match the codebase convention.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@freshlogic freshlogic merged commit f274775 into main May 12, 2026
2 checks passed
@farhatraiyan farhatraiyan deleted the add-validate-address branch May 14, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants