Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(plugins): type the uncloneable hook result assertion
Yudhi Armyndharis76baaee876f9
diff --git a/src/core/plugins/sandbox/worker-hooks.spec.ts b/src/core/plugins/sandbox/worker-hooks.spec.tsindex e65bf4652..eb77a2b85 100644--- a/src/core/plugins/sandbox/worker-hooks.spec.ts+++ b/src/core/plugins/sandbox/worker-hooks.spec.ts@@ -130,8 +130,9 @@ describe('WorkerHookRegistry', () => {reg.handleHook({ kind: 'hook', id: 1, event: 'e', data: { x: 1 }, source: 's' }),).resolves.toBeUndefined();- const result = sent.find(m => m.kind === 'hook-result');- expect(result).toMatchObject({ id: 1, continue: true, error: expect.stringContaining('could not be sent') });+ const result = sent.find(m => m.kind === 'hook-result') as Extract<WorkerToHostMessage, { kind: 'hook-result' }>;+ expect(result).toMatchObject({ id: 1, continue: true });+ expect(result.error).toContain('could not be sent');expect(result).not.toHaveProperty('data'); // the host keeps the original data});