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>
77 lines
2.6 KiB
Ruby
77 lines
2.6 KiB
Ruby
require 'rails_helper'
|
|
|
|
describe Dyte do
|
|
let(:dyte_client) { described_class.new('org_id', 'api_key') }
|
|
let(:headers) { { 'Content-Type' => 'application/json' } }
|
|
|
|
it 'raises an exception if api_key or organization ID is absent' do
|
|
expect { described_class.new }.to raise_error(StandardError)
|
|
end
|
|
|
|
context 'when create_a_meeting is called' do
|
|
context 'when API response is success' do
|
|
before do
|
|
stub_request(:post, 'https://api.dyte.io/v2/meetings')
|
|
.to_return(
|
|
status: 200,
|
|
body: { success: true, data: { id: 'meeting_id' } }.to_json,
|
|
headers: headers
|
|
)
|
|
end
|
|
|
|
it 'returns api response' do
|
|
response = dyte_client.create_a_meeting('title_of_the_meeting')
|
|
expect(response).to eq({ 'id' => 'meeting_id' })
|
|
end
|
|
end
|
|
|
|
context 'when API response is invalid' do
|
|
before do
|
|
stub_request(:post, 'https://api.dyte.io/v2/meetings')
|
|
.to_return(status: 422, body: { message: 'Title is required' }.to_json, headers: headers)
|
|
end
|
|
|
|
it 'returns error code with data' do
|
|
response = dyte_client.create_a_meeting('')
|
|
expect(response).to eq({ error: { 'message' => 'Title is required' }, error_code: 422 })
|
|
end
|
|
end
|
|
end
|
|
|
|
context 'when add_participant_to_meeting is called' do
|
|
context 'when API parameters are missing' do
|
|
it 'raises an exception' do
|
|
expect { dyte_client.add_participant_to_meeting }.to raise_error(StandardError)
|
|
end
|
|
end
|
|
|
|
context 'when API response is success' do
|
|
before do
|
|
stub_request(:post, 'https://api.dyte.io/v2/meetings/m_id/participants')
|
|
.to_return(
|
|
status: 200,
|
|
body: { success: true, data: { id: 'random_uuid', auth_token: 'json-web-token' } }.to_json,
|
|
headers: headers
|
|
)
|
|
end
|
|
|
|
it 'returns api response' do
|
|
response = dyte_client.add_participant_to_meeting('m_id', 'c_id', 'name', 'https://avatar.url')
|
|
expect(response).to eq({ 'id' => 'random_uuid', 'auth_token' => 'json-web-token' })
|
|
end
|
|
end
|
|
|
|
context 'when API response is invalid' do
|
|
before do
|
|
stub_request(:post, 'https://api.dyte.io/v2/meetings/m_id/participants')
|
|
.to_return(status: 422, body: { message: 'Meeting ID is invalid' }.to_json, headers: headers)
|
|
end
|
|
|
|
it 'returns error code with data' do
|
|
response = dyte_client.add_participant_to_meeting('m_id', 'c_id', 'name', 'https://avatar.url')
|
|
expect(response).to eq({ error: { 'message' => 'Meeting ID is invalid' }, error_code: 422 })
|
|
end
|
|
end
|
|
end
|
|
end
|