Spot the bug in inventory checks

from Examples and counterexamples
Node 24 intermediate 5 min 2 issues to find

Find why these generated checks cannot establish the requested inventory rule.

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

const cases = [
  { input: { stock: 4, reorderAt: 8, discontinued: false } },
  { input: { stock: 3, reorderAt: 8, discontinued: false } },
  { input: { stock: 2, reorderAt: 8, discontinued: false } },
];

for (const example of cases) {
  const expected = example.input.stock < 10 ? "reorder" : "hold";
  assert.equal(reorderDecision(example.input), expected);
}
Open in playground
Report an error