Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/graphql/resolvers/crm/contacts_resolver_spec.rb')
-rw-r--r--spec/graphql/resolvers/crm/contacts_resolver_spec.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/graphql/resolvers/crm/contacts_resolver_spec.rb b/spec/graphql/resolvers/crm/contacts_resolver_spec.rb
index 98da4aeac28..c7c2d11e114 100644
--- a/spec/graphql/resolvers/crm/contacts_resolver_spec.rb
+++ b/spec/graphql/resolvers/crm/contacts_resolver_spec.rb
@@ -16,6 +16,7 @@ RSpec.describe Resolvers::Crm::ContactsResolver do
last_name: "DEF",
email: "ghi@test.com",
description: "LMNO",
+ organization: create(:organization, group: group),
state: "inactive"
)
end
@@ -61,11 +62,29 @@ RSpec.describe Resolvers::Crm::ContactsResolver do
end
context 'when no filter is provided' do
- it 'returns all the contacts in the correct order' do
+ it 'returns all the contacts in the default order' do
expect(resolve_contacts(group)).to eq([contact_a, contact_b])
end
end
+ context 'when a sort is provided' do
+ it 'returns all the contacts in the correct order' do
+ expect(resolve_contacts(group, { sort: 'EMAIL_DESC' })).to eq([contact_b, contact_a])
+ end
+ end
+
+ context 'when a sort is provided needing offset_pagination' do
+ it 'returns all the contacts in the correct order' do
+ expect(resolve_contacts(group, { sort: 'ORGANIZATION_ASC' })).to eq([contact_a, contact_b])
+ end
+ end
+
+ context 'when filtering for all states' do
+ it 'returns all the contacts in the correct order' do
+ expect(resolve_contacts(group, { state: 'all' })).to eq([contact_a, contact_b])
+ end
+ end
+
context 'when search term is provided' do
it 'returns the correct contacts' do
expect(resolve_contacts(group, { search: "x@test.com" })).to contain_exactly(contact_b)