Chatwoot/spec/controllers/public/api/v1/inbox/inboxes_controller_spec.rb
CristianDuta 4c43330b15
feat: Add inbox details endpoint (#5549)
This change targets the public API and is related to the Inbox with channel type API.
Exposes public inbox details under /public/api/v1/inboxes/{inbox_identifier}. This allows access to feature flags and business hours configured for the inbox.

ref: #5514
2022-11-02 19:05:03 -07:00

18 lines
669 B
Ruby

require 'rails_helper'
RSpec.describe 'Public Inbox API', type: :request do
let!(:api_channel) { create(:channel_api) }
describe 'GET /public/api/v1/inboxes/{identifier}' do
it 'is able to fetch the details of an inbox' do
get "/public/api/v1/inboxes/#{api_channel.identifier}"
expect(response).to have_http_status(:success)
data = response.parsed_body
expect(data.keys).to include('name', 'timezone', 'working_hours', 'working_hours_enabled')
expect(data.keys).to include('csat_survey_enabled', 'greeting_enabled', 'identity_validation_enabled')
expect(data['identifier']).to eq api_channel.identifier
end
end
end