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: Vitest / Jest
testingassertionsvitestreadability
Use toBe for primitive equality and it.each for table-driven cases
Reserve toEqual for deep object/array equality; use toBe for primitives like strings and numbers. Collapse repetitive same-shape assertions with it.each.
PR: hegnar-bellsheep-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codets
| 1 | expect(format(940_123_000)).toEqual('940 M'); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | expect(format(940_123_000)).toBe('940 M'); |
Explanation (EN)
Objašnjenje (HR)