From e4c8dcdd31d8780c88d488dd39332850019a3218 Mon Sep 17 00:00:00 2001 From: Oriol Raventos Date: Fri, 4 Oct 2024 10:07:11 +0200 Subject: [PATCH] test(botonic-core): add a test for subscribe helpdesk event --- packages/botonic-core/tests/handoff.test.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/botonic-core/tests/handoff.test.ts b/packages/botonic-core/tests/handoff.test.ts index 5dda275755..3100f0f8e3 100644 --- a/packages/botonic-core/tests/handoff.test.ts +++ b/packages/botonic-core/tests/handoff.test.ts @@ -1,6 +1,6 @@ // @ts-nocheck import { BotonicAction, PATH_PAYLOAD_IDENTIFIER } from '../src' -import { HandOffBuilder, humanHandOff } from '../src/handoff' +import { HandOffBuilder, HelpdeskEvent, humanHandOff } from '../src/handoff' describe('Handoff', () => { test.each([ @@ -137,4 +137,13 @@ describe('Handoff', () => { const expectedBotonicAction = `${BotonicAction.CreateTestCase}:payload1` expect(builder._session._botonic_action).toEqual(expectedBotonicAction) }) + + test('Create a handoff and subscribe to agent_messsage_created', () => { + const builder = new HandOffBuilder({}) + .withSubscribeHelpdeskEvents([HelpdeskEvent.AgentMessageCreated]) + .withOnFinishPayload('payload1') + builder.handOff() + const expectedBotonicAction = `${BotonicAction.CreateCase}:{"force_assign_if_not_available":true,"on_finish":"payload1","subscribe_helpdesk_events":["agent_message_created"]}` + expect(builder._session._botonic_action).toEqual(expectedBotonicAction) + }) })