feat(automation): add isolated job delivery mode
This commit is contained in:
@@ -114,6 +114,25 @@ describe('WebhookHandler', () => {
|
||||
expect(messages[0].text).toBe('hello world');
|
||||
});
|
||||
|
||||
it('handleRequest uses isolated sender IDs when delivery mode is isolated_job', async () => {
|
||||
const webhooks = [makeWebhook()];
|
||||
handler = new WebhookHandler(webhooks, mockChannelRegistry as any, 'isolated_job');
|
||||
|
||||
const messages: InboundMessage[] = [];
|
||||
handler.onMessage((msg: InboundMessage) => messages.push(msg));
|
||||
await handler.connect();
|
||||
|
||||
const req = mockRequest('hello world');
|
||||
const res = mockResponse();
|
||||
const result = await handler.handleRequest('test-hook', req, res);
|
||||
|
||||
expect(result).toBe(true);
|
||||
expect(messages).toHaveLength(1);
|
||||
expect(messages[0].senderId).toMatch(/^test-hook:run-/);
|
||||
expect(messages[0].metadata?.replyPeerId).toBe('test-hook');
|
||||
expect(messages[0].metadata?.deliveryMode).toBe('isolated_job');
|
||||
});
|
||||
|
||||
it('returns false for unknown webhook', async () => {
|
||||
handler = new WebhookHandler([], mockChannelRegistry as any);
|
||||
await handler.connect();
|
||||
|
||||
Reference in New Issue
Block a user