What passing tests leave unresolved

A passing test shows what its fixture covered. It does not prove that a change handles every case the contract allows.

That distinction matters when a small mapper adds a default, the fixtures pass, and the pull request looks complete. The output can be green while the code has assigned meaning to an incomplete request.

An illustrative integration

In the free review exercise, a partner can send shipmentId and may omit countryCode. The downstream shipping request requires an explicit supported country. The proposed mapper supplies CA when the field is absent:

function proposedMap(payload) {
  return {
    shipmentId: payload.shipmentId,
    countryCode: payload.countryCode || "CA",
  };
}

Fixtures containing CA and US both pass. That shows the mapper preserves supplied values. It does not show that an omitted country means Canada, that an empty value is valid, or that the downstream system should receive an invented value.

The decision is in the default

|| "CA" looks like defensive programming. In this example, it is policy. It converts an incomplete request into a request for Canada.

That policy could be right in a particular workflow. The exercise does not supply evidence for it. The partner contract allows omission, while the downstream system needs an explicit supported value. A review should make the owner choose between rejection, correction, and review rather than hide the choice in a mapper.

A bounded alternative

The exercise uses an explicit check before constructing the downstream request:

function explicitMap(payload) {
  if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
    throw new Error("A request object is required");
  }
  if (typeof payload.shipmentId !== "string" || !payload.shipmentId.trim()) {
    throw new Error("A shipment identifier is required");
  }
  if (!["CA", "US"].includes(payload.countryCode)) {
    throw new Error("An explicit supported country is required");
  }
  return { shipmentId: payload.shipmentId, countryCode: payload.countryCode };
}

This is a bounded teaching example, not a production integration library. A real workflow might return a validation response, create a correction task, or use a review queue. The surrounding team must make and test that decision.

The runnable example covers supplied countries, the invented default, incomplete input, and unsupported input. It does not establish authentication, retries, concurrency, idempotency, logging, downstream effects, or recovery after an external request. That boundary belongs in the review result.

Download the free AI-assisted code review kit to run the exercise and compare the worked answer. The kit is complete without a subscription.