import { generateBotMessageContent } from '../botMessageContentHelper'; describe('#generateBotMessageContent', () => { it('return correct input_select content', () => { expect( generateBotMessageContent('input_select', { submitted_values: [{ value: 'salad', title: 'Salad' }], }) ).toEqual('Salad'); }); it('return correct input_email content', () => { expect( generateBotMessageContent('input_email', { submitted_email: 'hello@chatwoot.com', }) ).toEqual('hello@chatwoot.com'); }); it('return correct input_csat content', () => { expect( generateBotMessageContent('input_csat', { submitted_values: { csat_survey_response: { rating: 5, feedback_message: 'Great Service', }, }, }) ).toEqual( '
Rating

๐Ÿ˜

Feedback

Great Service

' ); expect( generateBotMessageContent( 'input_csat', { submitted_values: { csat_survey_response: { rating: 1, feedback_message: '' }, }, }, { csat: { ratingTitle: 'เดฑเต‡เดฑเตเดฑเดฟเด‚เด—เต', feedbackTitle: 'เดชเตเดฐเดคเดฟเด•เดฐเดฃเด‚' } } ) ).toEqual('
เดฑเต‡เดฑเตเดฑเดฟเด‚เด—เต

๐Ÿ˜ž

'); }); it('return correct form content', () => { expect( generateBotMessageContent('form', { items: [ { name: 'large_text', label: 'This a large text', }, { name: 'email', label: 'Email', }, ], submitted_values: [{ name: 'large_text', value: 'Large Text Content' }], }) ).toEqual( '
This a large text
Large Text Content

Email
No response

' ); }); });