Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
fullstack ruleP2universalStack: javascript
testingmockingclarity
Don't include mock properties the code under test never reads
Only set fields in a test mock that the tested code actually uses; extra properties (e.g. a `status` no branch depends on) mislead readers into thinking they matter.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codets
| 1 | // method never reads status, yet the mock requires and sets it |
| 2 | mockFetch({ status: 200, ok: true, data: { forum_id: 1 } }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | mockFetch({ ok: true, data: { forum_id: 1 } }); |
Explanation (EN)
Objašnjenje (HR)