Home / Companies / Speedscale / Blog / Post Details
Content Deep Dive

Mock the Wire

Blog post from Speedscale

Post Details
Company
Date Published
Author
Matt LeRay
Word Count
1,623
Company Posts That Month
17
Language
English
Hacker News Points
-
Post removed?
No
Summary

Earlier tests for a package notifier replaced the carrier lookup function entirely, effectively testing decision logic while leaving URL construction, headers, status handling, and JSON parsing untested. The post advocates adding small wire-level tests using a locally controlled fake HTTP server, allowing the real client to send requests and parse responses while tests verify paths, API-key and Accept headers, successful decoding of all known shipment states, 503 error handling, and malformed JSON behavior. It compares available server tools in Go, Java, Node.js, and Python, noting that Java and Node require test dependencies while Go and Python can use standard libraries, and highlights HTTP header case normalization in Python. Function stubs and fake servers serve complementary purposes: stubs efficiently test notifier behavior at an application seam, while fake-server tests validate the client’s protocol implementation between that seam and the network socket. However, because the fake server returns responses written by the test authors, these tests cannot confirm that the real carrier API continues to use the expected contract, such as field names or response structures.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.