Skip to content

Commit

Permalink
chore: Fix flaky contacts spec (#8773)
Browse files Browse the repository at this point in the history
- The ordering was not guaranteed; hence, the specs were failing randomly. Made changes to the expectations accordingly
  • Loading branch information
sojan-official committed Jan 24, 2024
1 parent 143299f commit a861257
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spec/controllers/api/v1/accounts/contacts_controller_spec.rb
Expand Up @@ -36,9 +36,11 @@

expect(response).to have_http_status(:success)
response_body = response.parsed_body
expect(response_body['payload'].first['email']).to eq(contact.email)
expect(response_body['payload'].first['contact_inboxes'].first['source_id']).to eq(contact_inbox.source_id)
expect(response_body['payload'].first['contact_inboxes'].first['inbox']['name']).to eq(contact_inbox.inbox.name)
contact_emails = response_body['payload'].pluck('email')
contact_inboxes_source_ids = response_body['payload'].flat_map { |c| c['contact_inboxes'].pluck('source_id') }

expect(contact_emails).to include(contact.email)
expect(contact_inboxes_source_ids).to include(contact_inbox.source_id)
end

it 'returns all contacts without contact inboxes' do
Expand Down

0 comments on commit a861257

Please sign in to comment.