From 648c4caca188a4fdaa9c953950f01a8b66ffec8e Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Mon, 29 Jan 2024 20:09:17 +0400 Subject: [PATCH] chore: Move EE OpenAI spec to correct folder (#8805) - We previously had this spec inside the enterprise folder which wouldn't be picked up by our build process, so moving to the correct folder instead. Co-authored-by: Shivam Mishra --- .../openai/processor_service_spec.rb | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) rename {enterprise/spec => spec/enterprise/lib}/integrations/openai/processor_service_spec.rb (74%) diff --git a/enterprise/spec/integrations/openai/processor_service_spec.rb b/spec/enterprise/lib/integrations/openai/processor_service_spec.rb similarity index 74% rename from enterprise/spec/integrations/openai/processor_service_spec.rb rename to spec/enterprise/lib/integrations/openai/processor_service_spec.rb index 966062d37..2a98514cf 100644 --- a/enterprise/spec/integrations/openai/processor_service_spec.rb +++ b/spec/enterprise/lib/integrations/openai/processor_service_spec.rb @@ -44,6 +44,8 @@ RSpec.describe Integrations::Openai::ProcessorService do create(:label, account: account) create(:label, account: account) + + hook.settings['label_suggestion'] = 'true' end it 'returns the label suggestions' do @@ -81,5 +83,26 @@ RSpec.describe Integrations::Openai::ProcessorService do expect(subject.perform).to be_nil end end + + context 'when hook is not enabled' do + let(:event) { { 'name' => 'label_suggestion', 'data' => { 'conversation_display_id' => conversation.display_id } } } + + before do + create(:message, account: account, conversation: conversation, message_type: :incoming, content: 'hello agent') + create(:message, account: account, conversation: conversation, message_type: :outgoing, content: 'hello customer') + create(:message, account: account, conversation: conversation, message_type: :incoming, content: 'hello agent 2') + create(:message, account: account, conversation: conversation, message_type: :incoming, content: 'hello agent 3') + create(:message, account: account, conversation: conversation, message_type: :incoming, content: 'hello agent 4') + + create(:label, account: account) + create(:label, account: account) + + hook.settings['label_suggestion'] = nil + end + + it 'returns nil' do + expect(subject.perform).to be_nil + end + end end end