mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
update test
This commit is contained in:
parent
4255c1fdfa
commit
e5e22c394d
@ -17,7 +17,7 @@ import { logger, i18n as localization } from '@test/testSetup'
|
||||
|
||||
import { userFactory } from '@/seeds/factory/user'
|
||||
import { login, updateHomeCommunityQuery } from '@/seeds/graphql/mutations'
|
||||
import { getCommunities, communitiesQuery, getCommunityByUuidQuery } from '@/seeds/graphql/queries'
|
||||
import { getCommunities, communitiesQuery, getCommunityQuery } from '@/seeds/graphql/queries'
|
||||
import { peterLustig } from '@/seeds/users/peter-lustig'
|
||||
|
||||
import { getCommunity } from './util/communities'
|
||||
@ -487,10 +487,10 @@ describe('CommunityResolver', () => {
|
||||
await DbCommunity.insert(foreignCom2)
|
||||
})
|
||||
|
||||
it('finds the home-community', async () => {
|
||||
it('finds the home-community by uuid', async () => {
|
||||
await expect(
|
||||
query({
|
||||
query: getCommunityByUuidQuery,
|
||||
query: getCommunityQuery,
|
||||
variables: { communityIdentifier: homeCom?.communityUuid },
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
@ -509,6 +509,28 @@ describe('CommunityResolver', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('finds the home-community by foreign', async () => {
|
||||
await expect(
|
||||
query({
|
||||
query: getCommunityQuery,
|
||||
variables: { foreign: false },
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
data: {
|
||||
community: {
|
||||
id: homeCom?.id,
|
||||
foreign: homeCom?.foreign,
|
||||
name: homeCom?.name,
|
||||
description: homeCom?.description,
|
||||
url: homeCom?.url,
|
||||
creationDate: homeCom?.creationDate?.toISOString(),
|
||||
uuid: homeCom?.communityUuid,
|
||||
authenticatedAt: homeCom?.authenticatedAt,
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
it('updates the home-community gmsApiKey', async () => {
|
||||
await expect(
|
||||
mutate({
|
||||
|
||||
@ -42,7 +42,7 @@ export class CommunityResolver {
|
||||
return dbCommunities.map((dbCom: DbCommunity) => new Community(dbCom))
|
||||
}
|
||||
|
||||
@Authorized([RIGHTS.COMMUNITIES])
|
||||
@Authorized([RIGHTS.COMMUNITY_BY_IDENTIFIER])
|
||||
@Query(() => Community)
|
||||
async community(@Args() communityArgs: CommunityArgs): Promise<Community> {
|
||||
const community = await getCommunity(communityArgs)
|
||||
|
||||
@ -134,9 +134,9 @@ export const communitiesQuery = gql`
|
||||
}
|
||||
`
|
||||
|
||||
export const getCommunityByUuidQuery = gql`
|
||||
query ($communityIdentifier: String!) {
|
||||
community(communityIdentifier: $communityIdentifier) {
|
||||
export const getCommunityQuery = gql`
|
||||
query ($communityIdentifier: String, $foreign: Boolean) {
|
||||
community(communityIdentifier: $communityIdentifier, foreign: $foreign) {
|
||||
id
|
||||
foreign
|
||||
name
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { gql, GraphQLClient } from 'graphql-request'
|
||||
import { SignJWT } from 'jose'
|
||||
|
||||
import { CONFIG } from '@/config'
|
||||
import { CommunityDraft } from '@/graphql/input/CommunityDraft'
|
||||
import { logger } from '@/logging/logger'
|
||||
import { LogError } from '@/server/LogError'
|
||||
import { SignJWT } from 'jose'
|
||||
|
||||
const communityByForeign = gql`
|
||||
query ($foreign: Boolean) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user