Some checks are pending
CI / Lint bridge (Biome) (push) Waiting to run
CI / Type-check bridge (push) Blocked by required conditions
CI / Tests unit bridge (push) Blocked by required conditions
CI / Tests integration bridge (push) Blocked by required conditions
CI / Security scan (push) Waiting to run
CI / Docker build + healthcheck (push) Blocked by required conditions
21 lines
784 B
TypeScript
21 lines
784 B
TypeScript
import pino from 'pino';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { handleDocmostEvent } from '../../src/webhooks/docmost-handler.js';
|
|
|
|
const silentLogger = () => pino({ level: 'silent' });
|
|
|
|
describe('handleDocmostEvent (stub Bloc 7b)', () => {
|
|
it('log + retourne logged avec eventType', () => {
|
|
const res = handleDocmostEvent(
|
|
{ event_id: 'doc-1', event_type: 'page.updated', page_id: 'p-1' },
|
|
{ logger: silentLogger() },
|
|
);
|
|
expect(res).toEqual({ status: 'logged', eventType: 'page.updated' });
|
|
});
|
|
|
|
it('event sans event_id ne crash pas', () => {
|
|
const res = handleDocmostEvent({ event_type: 'page.created' }, { logger: silentLogger() });
|
|
expect(res.status).toBe('logged');
|
|
expect(res.eventType).toBe('page.created');
|
|
});
|
|
});
|