From bba4ca0fc60ca942cfb279810ae6605fe8d24fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sun, 18 Sep 2022 19:18:44 +0200 Subject: [PATCH] Test 'descriptionExcerpt' in all relevant group resolvers --- backend/src/db/graphql/groups.js | 6 +++--- backend/src/schema/resolvers/groups.spec.js | 8 +++++++- webapp/graphql/groups.js | 10 +++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/backend/src/db/graphql/groups.js b/backend/src/db/graphql/groups.js index 35bf5c5f2..e388b2cd9 100644 --- a/backend/src/db/graphql/groups.js +++ b/backend/src/db/graphql/groups.js @@ -35,7 +35,7 @@ export const createGroupMutation = () => { deleted about description - # descriptionExcerpt # test this as result + descriptionExcerpt groupType actionRadius categories { @@ -89,7 +89,7 @@ export const updateGroupMutation = () => { deleted about description - # descriptionExcerpt # test this as result + descriptionExcerpt groupType actionRadius categories { @@ -165,7 +165,7 @@ export const groupQuery = () => { deleted about description - # descriptionExcerpt # test this as result + descriptionExcerpt groupType actionRadius categories { diff --git a/backend/src/schema/resolvers/groups.spec.js b/backend/src/schema/resolvers/groups.spec.js index 098ae85d2..98f37345b 100644 --- a/backend/src/schema/resolvers/groups.spec.js +++ b/backend/src/schema/resolvers/groups.spec.js @@ -303,6 +303,7 @@ describe('in mode', () => { slug: 'the-group', about: 'We will change the world!', description: 'Some description' + descriptionAdditional100, + descriptionExcerpt: 'Some description' + descriptionAdditional100, groupType: 'public', actionRadius: 'regional', locationName: 'Hamburg, Germany', @@ -553,7 +554,7 @@ describe('in mode', () => { describe('query groups', () => { describe('in general finds only listed groups – no hidden groups where user is none or pending member', () => { describe('without any filters', () => { - it('finds all listed groups – including the set locations', async () => { + it('finds all listed groups – including the set descriptionExcerpts and locations', async () => { const result = await query({ query: groupQuery(), variables: {} }) expect(result).toMatchObject({ data: { @@ -561,6 +562,7 @@ describe('in mode', () => { expect.objectContaining({ id: 'my-group', slug: 'the-best-group', + descriptionExcerpt: 'Some description' + descriptionAdditional100, locationName: 'Hamburg, Germany', location: expect.objectContaining({ name: 'Hamburg', @@ -572,6 +574,7 @@ describe('in mode', () => { expect.objectContaining({ id: 'others-group', slug: 'uninteresting-group', + descriptionExcerpt: 'We love it like it is!?' + descriptionAdditional100, locationName: null, location: null, myRole: null, @@ -579,6 +582,7 @@ describe('in mode', () => { expect.objectContaining({ id: 'third-hidden-group', slug: 'third-investigative-journalism-group', + descriptionExcerpt: 'We research …' + descriptionAdditional100, myRole: 'usual', locationName: null, location: null, @@ -2713,6 +2717,8 @@ describe('in mode', () => { slug: 'the-new-group-for-our-country', // changing the slug is tested in the slugifyMiddleware about: 'We will change the land!', description: 'Some country relevant description' + descriptionAdditional100, + descriptionExcerpt: + 'Some country relevant description' + descriptionAdditional100, actionRadius: 'national', // avatar, // test this as result myRole: 'owner', diff --git a/webapp/graphql/groups.js b/webapp/graphql/groups.js index 88be19ba7..5a1a2622c 100644 --- a/webapp/graphql/groups.js +++ b/webapp/graphql/groups.js @@ -35,7 +35,7 @@ export const createGroupMutation = () => { deleted about description - # descriptionExcerpt # test this as result + descriptionExcerpt groupType actionRadius categories { @@ -44,7 +44,7 @@ export const createGroupMutation = () => { name icon } - locationName # test this as result + locationName myRole } } @@ -84,7 +84,7 @@ export const updateGroupMutation = () => { deleted about description - descriptionExcerpt # test this as result + descriptionExcerpt groupType actionRadius categories { @@ -94,7 +94,7 @@ export const updateGroupMutation = () => { icon } # avatar # test this as result - locationName # test this as result + locationName myRole } } @@ -156,7 +156,7 @@ export const groupQuery = (i18n) => { deleted about description - descriptionExcerpt # test this as result + descriptionExcerpt groupType actionRadius categories {