From c4d9170e9d0322065d7f9b42f38a36042ab5ee56 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Tue, 27 Feb 2024 14:46:11 +0100 Subject: [PATCH] fix backend test --- backend/src/graphql/arg/UpdateUserInfosArgs.ts | 2 +- .../graphql/resolver/TransactionResolver.test.ts | 5 ----- backend/src/graphql/resolver/UserResolver.test.ts | 15 ++++++++------- backend/src/graphql/resolver/UserResolver.ts | 3 --- backend/src/seeds/graphql/mutations.ts | 4 ++-- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/backend/src/graphql/arg/UpdateUserInfosArgs.ts b/backend/src/graphql/arg/UpdateUserInfosArgs.ts index 4eade8f2f..a6c80cddd 100644 --- a/backend/src/graphql/arg/UpdateUserInfosArgs.ts +++ b/backend/src/graphql/arg/UpdateUserInfosArgs.ts @@ -46,7 +46,7 @@ export class UpdateUserInfosArgs { @IsBoolean() hideAmountGDT?: boolean - @Field({ nullable: true, defaultValue: true }) + @Field({ nullable: true }) @IsBoolean() gmsAllowed?: boolean diff --git a/backend/src/graphql/resolver/TransactionResolver.test.ts b/backend/src/graphql/resolver/TransactionResolver.test.ts index 1bb4a86f7..97e210dfa 100644 --- a/backend/src/graphql/resolver/TransactionResolver.test.ts +++ b/backend/src/graphql/resolver/TransactionResolver.test.ts @@ -15,8 +15,6 @@ import { ApolloServerTestClient } from 'apollo-server-testing' import { GraphQLError } from 'graphql' import { v4 as uuidv4 } from 'uuid' -import { GmsPublishLocationType } from '@enum/GmsPublishLocationType' -import { GmsPublishNameType } from '@enum/GmsPublishNameType' import { cleanDB, testEnvironment } from '@test/helpers' import { logger } from '@test/testSetup' @@ -534,9 +532,6 @@ describe('send coins', () => { mutation: updateUserInfos, variables: { alias: 'bob', - gmsAllowed: true, - gmsPublishName: GmsPublishNameType.GMS_PUBLISH_NAME_ALIAS_OR_INITALS, - gmsPublishLocation: GmsPublishLocationType.GMS_LOCATION_TYPE_RANDOM, }, }) await mutate({ diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index c570dbd9f..430aad2f5 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -1303,8 +1303,10 @@ describe('UserResolver', () => { mutation: updateUserInfos, variables: { gmsAllowed: false, - gmsPublishName: GmsPublishNameType.GMS_PUBLISH_NAME_FIRST_INITIAL, - gmsPublishLocation: GmsPublishLocationType.GMS_LOCATION_TYPE_APPROXIMATE, + gmsPublishName: + GmsPublishNameType[GmsPublishNameType.GMS_PUBLISH_NAME_FIRST_INITIAL], + gmsPublishLocation: + GmsPublishLocationType[GmsPublishLocationType.GMS_LOCATION_TYPE_APPROXIMATE], }, }) await expect(User.find()).resolves.toEqual([ @@ -1326,9 +1328,11 @@ describe('UserResolver', () => { mutation: updateUserInfos, variables: { gmsAllowed: true, - gmsPublishName: GmsPublishNameType.GMS_PUBLISH_NAME_ALIAS_OR_INITALS, + gmsPublishName: + GmsPublishNameType[GmsPublishNameType.GMS_PUBLISH_NAME_ALIAS_OR_INITALS], gmsLocation: loc, - gmsPublishLocation: GmsPublishLocationType.GMS_LOCATION_TYPE_RANDOM, + gmsPublishLocation: + GmsPublishLocationType[GmsPublishLocationType.GMS_LOCATION_TYPE_RANDOM], }, }) await expect(User.find()).resolves.toEqual([ @@ -2674,9 +2678,6 @@ describe('UserResolver', () => { mutation: updateUserInfos, variables: { alias: 'bibi', - gmsAllowed: true, - gmsPublishName: GmsPublishNameType.GMS_PUBLISH_NAME_ALIAS_OR_INITALS, - gmsPublishLocation: GmsPublishLocationType.GMS_LOCATION_TYPE_RANDOM, }, }) }) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index d0bba1e62..d980dabed 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -19,8 +19,6 @@ import { SearchUsersFilters } from '@arg/SearchUsersFilters' import { SetUserRoleArgs } from '@arg/SetUserRoleArgs' import { UnsecureLoginArgs } from '@arg/UnsecureLoginArgs' import { UpdateUserInfosArgs } from '@arg/UpdateUserInfosArgs' -import { GmsPublishLocationType } from '@enum/GmsPublishLocationType' -import { GmsPublishNameType } from '@enum/GmsPublishNameType' import { OptInType } from '@enum/OptInType' import { Order } from '@enum/Order' import { PasswordEncryptionType } from '@enum/PasswordEncryptionType' @@ -608,7 +606,6 @@ export class UserResolver { if (hideAmountGDT !== undefined) { user.hideAmountGDT = hideAmountGDT } - if (gmsAllowed !== undefined) { user.gmsAllowed = gmsAllowed } diff --git a/backend/src/seeds/graphql/mutations.ts b/backend/src/seeds/graphql/mutations.ts index b10bb4b4e..22c402e65 100644 --- a/backend/src/seeds/graphql/mutations.ts +++ b/backend/src/seeds/graphql/mutations.ts @@ -35,9 +35,9 @@ export const updateUserInfos = gql` $hideAmountGDD: Boolean $hideAmountGDT: Boolean $gmsAllowed: Boolean - $gmsPublishName: Int + $gmsPublishName: GmsPublishNameType $gmsLocation: Location - $gmsPublishLocation: Int + $gmsPublishLocation: GmsPublishLocationType ) { updateUserInfos( firstName: $firstName