Spot the bug in shipping checks

from Executable specifications
Node 24 intermediate 5 min 2 issues to find

Find why these generated checks do not independently specify the shipping boundary.

JavaScript
import assert from "node:assert/strict";

function shippingFeeCents(subtotalCents) {
  return subtotalCents >= 5000 ? 0 : 500;
}

const sampledSubtotals = [6000, 7000];
for (const subtotalCents of sampledSubtotals) {
  const expected = subtotalCents >= 5000 ? 0 : 500;
  assert.equal(shippingFeeCents(subtotalCents), expected);
}
Open in playground
Report an error