feat: Conversation API to return applied_sla and sla_events (#9174)
* chore: Add sla_events to push_event_data * chore: Return SLA details in the API * chore: feature lock sla push event data * Update _conversation.json.jbuilder * chore: rubocop fixes
This commit is contained in:
@@ -7,6 +7,27 @@ RSpec.describe AppliedSla, type: :model do
|
||||
it { is_expected.to belong_to(:conversation) }
|
||||
end
|
||||
|
||||
describe 'push_event_data' do
|
||||
it 'returns the correct hash' do
|
||||
applied_sla = create(:applied_sla)
|
||||
expect(applied_sla.push_event_data).to eq(
|
||||
{
|
||||
id: applied_sla.id,
|
||||
sla_id: applied_sla.sla_policy_id,
|
||||
sla_status: applied_sla.sla_status,
|
||||
created_at: applied_sla.created_at.to_i,
|
||||
updated_at: applied_sla.updated_at.to_i,
|
||||
sla_description: applied_sla.sla_policy.description,
|
||||
sla_name: applied_sla.sla_policy.name,
|
||||
sla_first_response_time_threshold: applied_sla.sla_policy.first_response_time_threshold,
|
||||
sla_next_response_time_threshold: applied_sla.sla_policy.next_response_time_threshold,
|
||||
sla_only_during_business_hours: applied_sla.sla_policy.only_during_business_hours,
|
||||
sla_resolution_time_threshold: applied_sla.sla_policy.resolution_time_threshold
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'validates_factory' do
|
||||
it 'creates valid applied sla policy object' do
|
||||
applied_sla = create(:applied_sla)
|
||||
|
||||
@@ -9,6 +9,21 @@ RSpec.describe SlaEvent, type: :model do
|
||||
it { is_expected.to belong_to(:inbox) }
|
||||
end
|
||||
|
||||
describe 'push_event_data' do
|
||||
it 'returns the correct hash' do
|
||||
sla_event = create(:sla_event)
|
||||
expect(sla_event.push_event_data).to eq(
|
||||
{
|
||||
id: sla_event.id,
|
||||
event_type: 'frt',
|
||||
meta: sla_event.meta,
|
||||
created_at: sla_event.created_at.to_i,
|
||||
updated_at: sla_event.updated_at.to_i
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'validates_factory' do
|
||||
it 'creates valid sla event object' do
|
||||
sla_event = create(:sla_event)
|
||||
|
||||
Reference in New Issue
Block a user