feat: Support after param in messages end point (#6848)
Adds support to `after` param while fetching messages Fixes: https://linear.app/chatwoot/issue/CW-1475/support-after-param-in-messages-end-point
This commit is contained in:
@@ -53,10 +53,25 @@ describe ::MessageFinder do
|
||||
|
||||
it 'filter conversations by status' do
|
||||
result = message_finder.perform
|
||||
expect(result.count).to be 6
|
||||
expect(result.first.id).to be conversation.messages.first.id
|
||||
expect(result.count).to be 5
|
||||
expect(result.first.id).to be conversation.messages.second.id
|
||||
expect(result.last.message_type).to eq 'outgoing'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with after and before attribute' do
|
||||
let(:params) do
|
||||
{
|
||||
after: conversation.messages.first.id,
|
||||
before: conversation.messages.last.id
|
||||
}
|
||||
end
|
||||
|
||||
it 'filter conversations by status' do
|
||||
result = message_finder.perform
|
||||
expect(result.count).to be 5
|
||||
expect(result.last.id).to be conversation.messages[-2].id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user