Skip to content

The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.

1.3 KB
Raw Blame
import { expect, test } from 'vitest'
import { withoutRecordingSentence, withRecordingSentence } from './assistant-prompt.ts'

// The recording notice as part of the greeting text (LIN-819).

test('the recording sentence goes into the greeting before its closing question, once, and comes out again (LIN-819)', () => {
  const greeting = 'Thanks for calling Brightwater. This is Maya, the AI assistant. How can I help?'
  const recorded = withRecordingSentence(greeting)
  expect(recorded).toBe(
    'Thanks for calling Brightwater. This is Maya, the AI assistant. This call may be recorded and transcribed. How can I help?',
  )
  expect(withRecordingSentence(recorded)).toBe(recorded)
  expect(withRecordingSentence('Calls are recorded for training. How can I help?')).toBe(
    'Calls are recorded for training. How can I help?',
  )
  expect(withRecordingSentence(greeting, 'de')).toContain('Dieser Anruf wird möglicherweise aufgezeichnet')
  expect(withRecordingSentence('')).toBe(
    'Thanks for calling. This call may be recorded and transcribed. How can I help?',
  )
  expect(withoutRecordingSentence(recorded)).toBe(greeting)
  expect(withoutRecordingSentence('Hi, this is Maya. Calls are recorded for training. How can I help?')).toBe(
    'Hi, this is Maya. How can I help?',
  )
})