chore: Sync pre-chat fields after custom attribute destroy (#4456)

This commit is contained in:
Muhsin Keloth
2022-04-18 14:06:27 +05:30
committed by GitHub
parent 04e890070d
commit e010f0c6f0
3 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
require 'rails_helper'
RSpec.describe Inboxes::SyncWidgetPreChatCustomFieldsJob, type: :job do
pre_chat_fields = [{
'label' => 'Developer Id',
'name' => 'developer_id'
}, {
'label' => 'Full Name',
'name' => 'full_name'
}]
pre_chat_message = 'Share your queries here.'
let!(:account) { create(:account) }
let!(:web_widget) do
create(:channel_widget, account: account, pre_chat_form_options: { pre_chat_message: pre_chat_message, pre_chat_fields: pre_chat_fields })
end
context 'when called' do
it 'reopens snoozed conversations whose snooze until has passed' do
described_class.perform_now(account, 'developer_id')
expect(web_widget.reload.pre_chat_form_options['pre_chat_fields']).to eq [{
'label' => 'Full Name',
'name' => 'full_name'
}]
end
end
end