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 ruleP2universalStack: node
testingmockssignaturemaintenance
Update call assertions when a function signature changes
When a function gains a parameter, its toHaveBeenCalledWith assertions must include the new argument or the test fails on a stale arity.
PR: hegnar-journalist-boost · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | // push now takes a trailing categoryId |
| 2 | expect(push).toHaveBeenCalledWith(title, ingress, authorId); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | expect(push).toHaveBeenCalledWith(title, ingress, authorId, undefined /* categoryId */); |
Explanation (EN)
Objašnjenje (HR)