Refine groups testing

This commit is contained in:
Wolfgang Huß 2022-09-05 09:01:42 +02:00
parent bfc60bcbf0
commit e713f65522
4 changed files with 14 additions and 7 deletions

View File

@ -12,7 +12,6 @@ export const createGroupMutation = gql`
$groupType: GroupType!
$actionRadius: GroupActionRadius!
$categoryIds: [ID]
$avatar: ImageInput
$locationName: String
) {
CreateGroup(
@ -24,7 +23,6 @@ export const createGroupMutation = gql`
groupType: $groupType
actionRadius: $actionRadius
categoryIds: $categoryIds
avatar: $avatar
locationName: $locationName
) {
id
@ -45,7 +43,6 @@ export const createGroupMutation = gql`
name
icon
}
# avatar # test this as result
# locationName # test this as result
myRole
}
@ -68,11 +65,11 @@ export const updateGroupMutation = gql`
id: $id
name: $name
slug: $slug
avatar: $avatar
about: $about
description: $description
actionRadius: $actionRadius
categoryIds: $categoryIds
avatar: $avatar
locationName: $locationName
) {
id

View File

@ -5,6 +5,7 @@ import { CATEGORIES_MIN, CATEGORIES_MAX } from '../../constants/categories'
import { DESCRIPTION_WITHOUT_HTML_LENGTH_MIN } from '../../constants/groups'
import { removeHtmlTags } from '../../middleware/helpers/cleanHtml.js'
import Resolver from './helpers/Resolver'
import { mergeImage } from './images/images'
export default {
Query: {
@ -135,7 +136,7 @@ export default {
UpdateGroup: async (_parent, params, context, _resolveInfo) => {
// Wolle: console.log('UpdateGroup !!!')
const { categoryIds } = params
const { id: groupId } = params
const { id: groupId, avatar: avatarInput } = params
// Wolle: console.log('categoryIds: ', categoryIds)
// Wolle: console.log('groupId: ', groupId)
delete params.categoryIds
@ -191,6 +192,9 @@ export default {
params,
})
const [group] = await transactionResponse.records.map((record) => record.get('group'))
if (avatarInput) {
await mergeImage(group, 'AVATAR_IMAGE', avatarInput, { transaction })
}
return group
})
try {

View File

@ -17,6 +17,7 @@ const neode = getNeode()
let authenticatedUser
let user
// Wolle: let groupAvartar
const categoryIds = ['cat9', 'cat4', 'cat15']
const descriptionAdditional100 =
@ -73,6 +74,9 @@ const seedBasicsAndClearAuthentication = async () => {
icon: 'paw',
}),
])
// Wolle: groupAvartar = await Factory.build('image', {
// url: 'https://s3.amazonaws.com/uifaces/faces/twitter/jimmuirhead/128.jpg',
// })
authenticatedUser = null
}
@ -107,7 +111,6 @@ describe('in mode', () => {
groupType: 'public',
actionRadius: 'regional',
categoryIds,
// avatar, // test this as result
// locationName, // test this as result
}
})
@ -132,6 +135,9 @@ describe('in mode', () => {
name: 'The Best Group',
slug: 'the-group',
about: 'We will change the world!',
description: 'Some description' + descriptionAdditional100,
groupType: 'public',
actionRadius: 'regional',
},
},
errors: undefined,

View File

@ -101,7 +101,7 @@ type Mutation {
groupType: GroupType!
actionRadius: GroupActionRadius!
categoryIds: [ID]
avatar: ImageInput # test this as result
# avatar: ImageInput # a group can not be created with an avatar
locationName: String # test this as result
): Group