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:
Muhsin Keloth
2023-04-07 13:42:54 +05:30
committed by GitHub
parent 406e8405eb
commit a521762dd6
2 changed files with 38 additions and 5 deletions

View File

@@ -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