Skip to content

Commit

Permalink
test(botonic-core): add a test for subscribe helpdesk event
Browse files Browse the repository at this point in the history
  • Loading branch information
Iru89 committed Oct 4, 2024
1 parent a4fce18 commit e4c8dcd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/botonic-core/tests/handoff.test.ts
Original file line number Diff line number Diff line change
@@ -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([
Expand Down Expand Up @@ -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)
})
})

0 comments on commit e4c8dcd

Please sign in to comment.