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 ruleP1universalStack: TypeScript
testingmockscorrectnessnull-handling
Handle problematic data in code, don't strip it from test fixtures
If the backend can return a value (e.g. null), keep it in the mock and handle it in the component; removing it from fixtures just hides the bug.
PR: hegnar-bellsheep-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codets
| 1 | return HttpResponse.json([ |
| 2 | { fullname: 'ABG', id: 1 }, |
| 3 | // { fullname: null, id: 3 }, <-- deleted to make the test pass |
| 4 | ]); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | return HttpResponse.json([ |
| 2 | { fullname: 'ABG', id: 1 }, |
| 3 | { fullname: null, id: 3 }, // kept; component filters out null fullname |
| 4 | ]); |
Explanation (EN)
Objašnjenje (HR)