Initial commit: Add logistics and order_detail message types
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Twilio::VoiceWebhookSetupService do
|
||||
let(:account_sid) { 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' }
|
||||
let(:auth_token) { 'auth_token_123' }
|
||||
let(:api_key_sid) { 'SKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' }
|
||||
let(:api_key_secret) { 'api_key_secret_123' }
|
||||
let(:phone_number) { '+15551230001' }
|
||||
let(:frontend_url) { 'https://app.chatwoot.test' }
|
||||
|
||||
let(:channel) do
|
||||
build(:channel_voice, phone_number: phone_number, provider_config: {
|
||||
account_sid: account_sid,
|
||||
auth_token: auth_token,
|
||||
api_key_sid: api_key_sid,
|
||||
api_key_secret: api_key_secret
|
||||
})
|
||||
end
|
||||
|
||||
let(:twilio_base_url) { "https://api.twilio.com/2010-04-01/Accounts/#{account_sid}" }
|
||||
let(:incoming_numbers_url) { "#{twilio_base_url}/IncomingPhoneNumbers.json" }
|
||||
let(:applications_url) { "#{twilio_base_url}/Applications.json" }
|
||||
let(:phone_number_sid) { 'PN123' }
|
||||
let(:phone_number_url) { "#{twilio_base_url}/IncomingPhoneNumbers/#{phone_number_sid}.json" }
|
||||
|
||||
before do
|
||||
# Token validation using Account SID + Auth Token
|
||||
stub_request(:get, /#{Regexp.escape(incoming_numbers_url)}.*/)
|
||||
.with(basic_auth: [account_sid, auth_token])
|
||||
.to_return(status: 200,
|
||||
body: { incoming_phone_numbers: [], meta: { key: 'incoming_phone_numbers' } }.to_json,
|
||||
headers: { 'Content-Type' => 'application/json' })
|
||||
|
||||
# Number lookup using API Key SID/Secret
|
||||
stub_request(:get, /#{Regexp.escape(incoming_numbers_url)}.*/)
|
||||
.with(basic_auth: [api_key_sid, api_key_secret])
|
||||
.to_return(status: 200,
|
||||
body: { incoming_phone_numbers: [{ sid: phone_number_sid }], meta: { key: 'incoming_phone_numbers' } }.to_json,
|
||||
headers: { 'Content-Type' => 'application/json' })
|
||||
|
||||
# TwiML App create (voice only)
|
||||
stub_request(:post, applications_url)
|
||||
.with(basic_auth: [api_key_sid, api_key_secret])
|
||||
.to_return(status: 201,
|
||||
body: { sid: 'AP123' }.to_json,
|
||||
headers: { 'Content-Type' => 'application/json' })
|
||||
|
||||
# Incoming Phone Number webhook update
|
||||
stub_request(:post, phone_number_url)
|
||||
.with(basic_auth: [api_key_sid, api_key_secret])
|
||||
.to_return(status: 200,
|
||||
body: { sid: phone_number_sid }.to_json,
|
||||
headers: { 'Content-Type' => 'application/json' })
|
||||
end
|
||||
|
||||
it 'creates a TwiML App and configures number webhooks with correct URLs' do
|
||||
with_modified_env FRONTEND_URL: frontend_url do
|
||||
service = described_class.new(channel: channel)
|
||||
sid = service.perform
|
||||
|
||||
expect(sid).to eq('AP123')
|
||||
|
||||
expected_voice_url = channel.voice_call_webhook_url
|
||||
expected_status_url = channel.voice_status_webhook_url
|
||||
|
||||
# Assert TwiML App creation body includes voice URL and POST method
|
||||
expect(
|
||||
a_request(:post, applications_url)
|
||||
.with(body: hash_including('VoiceUrl' => expected_voice_url, 'VoiceMethod' => 'POST'))
|
||||
).to have_been_made
|
||||
|
||||
# Assert number webhook update body includes both URLs and POST methods
|
||||
expect(
|
||||
a_request(:post, phone_number_url)
|
||||
.with(
|
||||
body: hash_including(
|
||||
'VoiceUrl' => expected_voice_url,
|
||||
'VoiceMethod' => 'POST',
|
||||
'StatusCallback' => expected_status_url,
|
||||
'StatusCallbackMethod' => 'POST'
|
||||
)
|
||||
)
|
||||
).to have_been_made
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user