• 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

46.67
/src/Event.ts
1
import { IEvent } from './interfaces';
2

3
/**
4
 * Get text description of an event for logging purposes
5
 */
6
export function describe(event: IEvent): string {
32✔
7
        return `'${event.type}' of ${event.aggregateId} (v${event.aggregateVersion})`;
×
8
}
9

10
/**
11
 * Get text description of a set of events for logging purposes
12
 */
13
export function describeMultiple(events: ReadonlyArray<IEvent>): string {
32✔
14
        if (events.length === 1)
×
15
                return describe(events[0]);
×
16

17
        return `${events.length} events`;
×
18
}
19

20
/**
21
 * Validate event structure
22
 */
23
export function validate(event: IEvent) {
32✔
24
        if (typeof event !== 'object' || !event)
14!
25
                throw new TypeError('event must be an Object');
×
26
        if (typeof event.type !== 'string' || !event.type.length)
14✔
27
                throw new TypeError('event.type must be a non-empty String');
×
28
        if (!event.aggregateId && !event.sagaId)
14!
29
                throw new TypeError('either event.aggregateId or event.sagaId is required');
×
30
        if (event.sagaId && typeof event.sagaVersion === 'undefined')
14!
31
                throw new TypeError('event.sagaVersion is required, when event.sagaId is defined');
×
32
}
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