From 7e793f13f79278a35c22beaa0be1dc4df55f5771 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Mon, 24 Nov 2025 18:03:42 +0100 Subject: [PATCH] fix backend unit test errors --- .bun-version | 2 +- .../resolver/ContributionMessageResolver.test.ts | 4 +--- .../graphql/resolver/ContributionResolver.test.ts | 13 ++++--------- backend/src/graphql/resolver/UserResolver.test.ts | 10 +++++----- backend/test/testSetup.ts | 2 +- backend/tsconfig.json | 2 +- 6 files changed, 13 insertions(+), 20 deletions(-) diff --git a/.bun-version b/.bun-version index 785cda807..589268e6f 100644 --- a/.bun-version +++ b/.bun-version @@ -1 +1 @@ -1.3.3 \ No newline at end of file +1.3.0 \ No newline at end of file diff --git a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts index d29bf5235..483747b90 100644 --- a/backend/src/graphql/resolver/ContributionMessageResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionMessageResolver.test.ts @@ -34,9 +34,7 @@ jest.mock('core', () => { return { __esModule: true, ...originalModule, - sendAddedContributionMessageEmail: jest.fn((a) => - originalModule.sendAddedContributionMessageEmail(a), - ), + sendAddedContributionMessageEmail: jest.fn(), } }) diff --git a/backend/src/graphql/resolver/ContributionResolver.test.ts b/backend/src/graphql/resolver/ContributionResolver.test.ts index fd31a5275..31d405942 100644 --- a/backend/src/graphql/resolver/ContributionResolver.test.ts +++ b/backend/src/graphql/resolver/ContributionResolver.test.ts @@ -58,15 +58,10 @@ jest.mock('core', () => { return { __esModule: true, ...originalModule, - sendContributionDeniedEmail: jest.fn((a) => - originalModule.sendContributionDeniedEmail(a), - ), - sendContributionConfirmedEmail: jest.fn((a) => - originalModule.sendContributionConfirmedEmail(a), - ), - sendContributionDeletedEmail: jest.fn((a) => - originalModule.sendContributionDeletedEmail(a), - ), + sendContributionDeniedEmail: jest.fn(), + sendContributionConfirmedEmail: jest.fn(), + sendContributionDeletedEmail: jest.fn(), + sendEmailTranslated: jest.fn(), } }) jest.mock('@/password/EncryptorUtils') diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index d5bad3bc8..0fd06c0d1 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -78,11 +78,10 @@ jest.mock('core', () => { return { __esModule: true, ...originalModule, - sendAccountActivationEmail: jest.fn((a) => originalModule.sendAccountActivationEmail(a)), - sendAccountMultiRegistrationEmail: jest.fn((a) => - originalModule.sendAccountMultiRegistrationEmail(a), - ), - sendResetPasswordEmail: jest.fn((a) => originalModule.sendResetPasswordEmail(a)), + sendAccountActivationEmail: jest.fn(), + sendAccountMultiRegistrationEmail: jest.fn(), + sendResetPasswordEmail: jest.fn(), + sendEmailTranslated: jest.fn(), } }) @@ -154,6 +153,7 @@ describe('UserResolver', () => { expect(result).toEqual( expect.objectContaining({ data: { createUser: { id: expect.any(Number) } } }), ) + }) describe('valid input data', () => { diff --git a/backend/test/testSetup.ts b/backend/test/testSetup.ts index 6a009e652..841046e0f 100644 --- a/backend/test/testSetup.ts +++ b/backend/test/testSetup.ts @@ -3,7 +3,7 @@ import { CONFIG } from '@/config' import { CONFIG as CORE_CONFIG } from 'core' import { getLogger, printLogs, clearLogs } from 'config-schema/test/testSetup' -CORE_CONFIG.EMAIL = true +CORE_CONFIG.EMAIL = false CORE_CONFIG.EMAIL_TEST_MODUS = false CONFIG.HUMHUB_ACTIVE = false CONFIG.GMS_ACTIVE = false diff --git a/backend/tsconfig.json b/backend/tsconfig.json index d330e2b81..b71bf1938 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -87,7 +87,7 @@ "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ }, "include": [ - "../core/src/types", + "../core/src/types" ], "ts-node": { "swc": true