10 lines
479 B
TypeScript
10 lines
479 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { validateEvent } from './eventValidation';
|
|
describe('event validation', () => {
|
|
it.each([
|
|
[{}, 'Unsupported event schema'],
|
|
[{ schemaVersion: 1 }, 'Missing envelope identity'],
|
|
[{ schemaVersion: 1, eventId: 'a', streamId: 's', entity: {}, sequence: -1 }, 'Invalid monotonic sequence'],
|
|
])('rejects malformed envelopes', (value, reason) => expect(validateEvent(value)).toEqual({ valid: false, reason }));
|
|
});
|