From f6a88d7f123650766ae92d3b45fd636cee20b2e1 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Thu, 7 May 2026 17:12:39 +0700 Subject: [PATCH] test(voice): align WhatsApp call specs with feature gate and v22 calls path - call_permission_reply specs: enable channel_voice and set provider_config['source'] = 'embedded_signup' so voice_enabled? returns true; without it the service short-circuits before any handling. - whatsapp_cloud_service specs: stub /v22.0//calls (and /messages) to match calls_phone_id_path, which uses WHATSAPP_API_VERSION (fallback v22.0). The OSS v13.0 path is locked for legacy /messages compatibility only. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../whatsapp/providers/whatsapp_cloud_service_spec.rb | 6 ++++-- .../services/whatsapp/call_permission_reply_service_spec.rb | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb b/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb index 4cbfd27e8..87dc6d70c 100644 --- a/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb +++ b/spec/enterprise/services/enterprise/whatsapp/providers/whatsapp_cloud_service_spec.rb @@ -4,8 +4,10 @@ describe Whatsapp::Providers::WhatsappCloudService do subject(:service) { described_class.new(whatsapp_channel: whatsapp_channel) } let(:whatsapp_channel) { create(:channel_whatsapp, provider: 'whatsapp_cloud', validate_provider_config: false, sync_templates: false) } - let(:calls_url) { 'https://graph.facebook.com/v13.0/123456789/calls' } - let(:messages_url) { 'https://graph.facebook.com/v13.0/123456789/messages' } + # Call-flow endpoints use the configured WHATSAPP_API_VERSION (fallback v22.0), + # not the OSS v13.0 path locked for legacy /messages compatibility. + let(:calls_url) { 'https://graph.facebook.com/v22.0/123456789/calls' } + let(:messages_url) { 'https://graph.facebook.com/v22.0/123456789/messages' } let(:headers) { { 'Content-Type' => 'application/json' } } before { stub_request(:get, /message_templates/) } diff --git a/spec/enterprise/services/whatsapp/call_permission_reply_service_spec.rb b/spec/enterprise/services/whatsapp/call_permission_reply_service_spec.rb index 4504c7d9e..82a91395c 100644 --- a/spec/enterprise/services/whatsapp/call_permission_reply_service_spec.rb +++ b/spec/enterprise/services/whatsapp/call_permission_reply_service_spec.rb @@ -19,7 +19,8 @@ describe Whatsapp::CallPermissionReplyService do end before do - channel.provider_config = channel.provider_config.merge('calling_enabled' => true) + account.enable_features!('channel_voice') + channel.provider_config = channel.provider_config.merge('source' => 'embedded_signup', 'calling_enabled' => true) channel.save! end