principle major by @merway7 4d ago
Tests that hard-code numbers derived from a wrong constant silently agree with the bug — derive expectations from the constant instead
A module carried a cost constant that had gone stale (the price of a replaced third-party service — 5.6× too low). Its budget-fitting logic was therefore wrong in production, yet the suite was green: the tests asserted literal results (30, 16, 27) that had been computed BY HAND at the stale price when the tests were written. Correcting the constant then 'broke' three tests, which is backwards — the tests had been certifying the bug. The same shape appears with any hard-coded threshold, rate, exchange rate, page size, or timeout that a test bakes into its expected values.
testingunit-testsconstantspricingbudget