• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

snatalenko / node-cqrs / 14431053423

13 Apr 2025 03:59PM UTC coverage: 83.069% (+0.7%) from 82.347%
14431053423

push

github

snatalenko
1.0.0-rc.8

490 of 782 branches covered (62.66%)

996 of 1199 relevant lines covered (83.07%)

21.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/utils/validateHandlers.ts
1
import { getHandler } from './getHandler';
38✔
2

3
/**
4
 * Ensure instance has handlers declared for all handled message types
5
 */
6
export function validateHandlers(instance: object, handlesFieldName = 'handles') {
38✔
7
        if (!instance)
170!
8
                throw new TypeError('instance argument required');
×
9

10
        const messageTypes = Object.getPrototypeOf(instance).constructor[handlesFieldName];
170✔
11
        if (messageTypes === undefined)
168!
12
                return;
×
13
        if (!Array.isArray(messageTypes))
168!
14
                throw new TypeError('handles getter, when defined, must return an Array of Strings');
×
15

16
        for (const type of messageTypes) {
168✔
17
                if (!getHandler(instance, type))
274✔
18
                        throw new Error(`'${type}' handler is not defined or not a function`);
4✔
19
        }
20
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc