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
testingmockingclean-codemsw
Keep only the mocks a test actually consumes
Drop unused HTTP mocks/nocks that never get matched; leave only the ones the test exercises so 'not done' warnings disappear and intent is clear.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | nock(api).get('/post?id=1'); |
| 2 | nock(api).get('/post?id=2'); // only id=1 is fetched |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | nock(api).get('/post?id=1'); |
Explanation (EN)
Objašnjenje (HR)