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).
backend ruleP1universalStack: universal
testingassertionscoveragesql
Assert complete, balanced clauses in tests rather than truncated prefixes
A toContain check on a partial expression passes even when later parts (closing parens, sort key, direction, tiebreaker) regress; assert the full clause and cover both directions.
PR: vinify-backend · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | expect(sql).toContain('ORDER BY ISNULL(COALESCE('); // stops mid-expression |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | expect(sql).toContain('ORDER BY ISNULL(COALESCE(...)) DESC, table.id'); |
| 2 | // + a second test with ASC |
Explanation (EN)
Objašnjenje (HR)