Skip to content

test: validate outgoing request format in UPStrack and getUPS#33

Draft
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/test-request-validation
Draft

test: validate outgoing request format in UPStrack and getUPS#33
toddr-bot wants to merge 1 commit into
mainfrom
koan.toddr.bot/test-request-validation

Conversation

@toddr-bot
Copy link
Copy Markdown
Contributor

@toddr-bot toddr-bot commented Apr 6, 2026

What

Add tests that verify the HTTP requests sent by UPStrack() and getUPS(), not just the response parsing.

Why

Existing tests mock HTTP responses but never inspect the outgoing request. If someone refactors request construction — changes the URL, drops a header, or alters the JSON payload — all tests still pass because mocks return fixed data regardless of what was sent. This is a real regression risk.

How

  • UPStrack: New subtests capture the POST URL, Content-Type header, and JSON body. Validates endpoint URL, header value, payload structure (Locale, TrackingNumber array), and that the tracking number from input appears in the payload.
  • getUPS: New subtest captures the GET URL and validates base endpoint, license agreement parameter, and all required query params (product, origin, dest, weight).

Testing

make test — 26 tests pass (was 24 before, +2 new subtests with multiple assertions each).

🤖 Generated with Claude Code


Quality Report

Changes: 2 files changed, 92 insertions(+)

Code scan: clean

Tests: passed (OK)

Branch hygiene: clean

Generated by Kōan post-mission quality pipeline

The existing tests mock HTTP responses but never verify the outgoing
request format. If someone refactors the request construction (URL,
headers, or payload), all tests still pass because mocks return fixed
data regardless of input.

Add subtests that capture and validate:
- UPStrack: POST URL, Content-Type header, JSON payload structure
  (Locale, TrackingNumber array), and tracking number passthrough
- getUPS: base URL, license agreement param, required query params
  (product, origin, dest, weight)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant