Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Make test titles precisely describe the case under test
Word test names with accurate terminology that matches the real behaviour, since the title is the case's documentation.
Bad example
| 1 | test('non-numeric ?v= resets to v=1', async () => { |
| 2 | // input is '?v=1_29' — numeric-ish but not an integer |
| 3 | }); |
Explanation (EN)
'non-numeric' misdescribes the '1_29' input and the 'v=1' output, so the title misleads about what is actually verified.
Objašnjenje (HR)
'non-numeric' pogresno opisuje ulaz '1_29' i izlaz 'v=1', pa naslov zavarava o tome sto se zapravo provjerava.
Good example
| 1 | test('non-integer ?v= resets to ?v=1', async () => { |
| 2 | // accurately names both the input class and the exact output |
| 3 | }); |
Explanation (EN)
A precise title doubles as documentation and tells the next reader exactly which case is covered without reading the body.
Objašnjenje (HR)
Precizan naslov sluzi kao dokumentacija i govori sljedecem citatelju tocno koji je slucaj pokriven bez citanja tijela testa.