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
testingedge-casesrobustnessvalidation
Add tests for boundary values and guarantee no crash on invalid input
Cover edge cases like zero, negatives, and large numbers, and verify that passing invalid input does not throw a 500.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | expect(formatNumber(123.45)).toBe('123,45'); // only the happy path |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | expect(formatNumber(0)).toBe('0,00'); |
| 2 | expect(formatNumber(-1235678.45)).toBe('-1.235.678,45'); |
| 3 | expect(formatNumber(1235678.45)).toBe('1.235.678,45'); |
| 4 | expect(() => formatNumber('not-a-number' as never)).not.toThrow(); |
Explanation (EN)
Objašnjenje (HR)