mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
fix backend user resolver test
This commit is contained in:
parent
3606f9189e
commit
9ede9c0e5b
@ -32,7 +32,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-env": "^7.0.3",
|
||||
"email-templates": "^10.0.1",
|
||||
"email-templates": "10.0.1",
|
||||
"sodium-native": "^3.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -41,14 +41,14 @@
|
||||
"@swc/cli": "^0.7.3",
|
||||
"@swc/core": "^1.11.24",
|
||||
"@swc/helpers": "^0.5.17",
|
||||
"@types/email-templates": "^10.0.4",
|
||||
"@types/email-templates": "10.0.1",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/faker": "^5.5.9",
|
||||
"@types/i18n": "^0.13.4",
|
||||
"@types/jest": "27.0.2",
|
||||
"@types/lodash.clonedeep": "^4.5.6",
|
||||
"@types/node": "^17.0.21",
|
||||
"@types/nodemailer": "^6.4.4",
|
||||
"@types/nodemailer": "6.4.17",
|
||||
"@types/sodium-native": "^2.3.5",
|
||||
"@types/source-map-support": "^0.5.10",
|
||||
"@types/uuid": "^8.3.4",
|
||||
@ -82,7 +82,7 @@
|
||||
"log4js": "^6.7.1",
|
||||
"mkdirp": "^3.0.1",
|
||||
"ncp": "^2.0.0",
|
||||
"nodemailer": "^6.6.5",
|
||||
"nodemailer": "6.6.5",
|
||||
"nodemon": "^2.0.7",
|
||||
"openai": "^4.87.3",
|
||||
"prettier": "^3.5.3",
|
||||
|
||||
@ -15,6 +15,7 @@ import {
|
||||
UserLoggingView,
|
||||
} from 'database'
|
||||
import { TransactionDraft } from './model/TransactionDraft'
|
||||
import { CONFIG } from '@/config'
|
||||
|
||||
const logger = getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.dltConnector`)
|
||||
// will be undefined if dlt connect is disabled
|
||||
@ -63,6 +64,9 @@ async function executeDltTransaction(draft: TransactionDraft | null, typeId: Dlt
|
||||
* and update dltTransactionId of transaction in db with hiero transaction id
|
||||
*/
|
||||
export async function registerAddressTransaction(user: DbUser, community: DbCommunity): Promise<DbDltTransaction | null> {
|
||||
if (!CONFIG.DLT_CONNECTOR) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
if (!user.id) {
|
||||
logger.error(`missing id for user: ${user.gradidoID}, please call registerAddressTransaction after user.save()`)
|
||||
return null
|
||||
@ -84,6 +88,9 @@ export async function contributionTransaction(
|
||||
signingUser: DbUser,
|
||||
createdAt: Date,
|
||||
): Promise<DbDltTransaction | null> {
|
||||
if (!CONFIG.DLT_CONNECTOR) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
const homeCommunity = await getHomeCommunity()
|
||||
if (!homeCommunity) {
|
||||
logger.error('home community not found')
|
||||
@ -100,6 +107,9 @@ export async function transferTransaction(
|
||||
memo: string,
|
||||
createdAt: Date
|
||||
): Promise<DbDltTransaction | null> {
|
||||
if (!CONFIG.DLT_CONNECTOR) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
// load community if not already loaded, maybe they are remote communities
|
||||
if (!senderUser.community) {
|
||||
senderUser.community = await getCommunityByUuid(senderUser.communityUuid)
|
||||
@ -115,6 +125,9 @@ export async function transferTransaction(
|
||||
|
||||
export async function deferredTransferTransaction(senderUser: DbUser, transactionLink: DbTransactionLink)
|
||||
: Promise<DbDltTransaction | null> {
|
||||
if (!CONFIG.DLT_CONNECTOR) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
// load community if not already loaded
|
||||
if (!senderUser.community) {
|
||||
senderUser.community = await getCommunityByUuid(senderUser.communityUuid)
|
||||
@ -125,6 +138,9 @@ export async function deferredTransferTransaction(senderUser: DbUser, transactio
|
||||
|
||||
export async function redeemDeferredTransferTransaction(transactionLink: DbTransactionLink, amount: string, createdAt: Date, recipientUser: DbUser)
|
||||
: Promise<DbDltTransaction | null> {
|
||||
if (!CONFIG.DLT_CONNECTOR) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
// load user and communities if not already loaded
|
||||
if (!transactionLink.user) {
|
||||
logger.debug('load sender user')
|
||||
|
||||
@ -79,11 +79,9 @@ jest.mock('@/emails/sendEmailVariants', () => {
|
||||
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(),
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@ export const userFactory = async (
|
||||
user: UserInterface,
|
||||
): Promise<User> => {
|
||||
const { mutate } = client
|
||||
|
||||
const homeCom = await writeHomeCommunityEntry()
|
||||
// console.log('call createUser with', JSON.stringify(user, null, 2))
|
||||
const response = await mutate({ mutation: createUser, variables: user })
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user