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
testingfile-structurenamingcolocation
Name and locate tests after the unit under test
Put a test next to the file it covers and name it after that unit, rather than under an unrelated entry/feature name.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codets
| 1 | // src/entries/__test__/subscription-banner.test.tsx |
| 2 | import Banner from '../../components/Banner'; // actually testing Banner |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | // src/components/Banner/__tests__/Banner.test.tsx |
| 2 | import Banner from '..'; |
Explanation (EN)
Objašnjenje (HR)