fix tests

This commit is contained in:
einhornimmond 2025-03-18 13:32:32 +01:00
parent 93eb816d2b
commit d222f6739a
4 changed files with 7 additions and 4 deletions

View File

@ -7,7 +7,7 @@ module.exports = {
collectCoverageFrom: ['src/**/*.ts', '!**/node_modules/**', '!src/seeds/**', '!build/**'],
coverageThreshold: {
global: {
lines: 79,
lines: 78,
},
},
setupFiles: ['<rootDir>/test/testSetup.ts'],

View File

@ -328,14 +328,14 @@ export const schema = Joi.object({
OPENAI_API_KEY: Joi.string()
.pattern(/^sk-[A-Za-z0-9-_]{20,}$/)
.when('OPENAI_ACTIVE', { is: true, then: Joi.required() })
.when('OPENAI_ACTIVE', { is: true, then: Joi.required(), otherwise: Joi.optional() })
.description(
'API key for OpenAI, must be at least 20 characters long and contain only alphanumeric characters, dashes, or underscores',
),
OPENAI_ASSISTANT_ID: Joi.string()
.pattern(/^asst_[A-Za-z0-9-]{20,}$/)
.when('OPENAI_ACTIVE', { is: true, then: Joi.required() })
.when('OPENAI_ACTIVE', { is: true, then: Joi.required(), otherwise: Joi.optional() })
.description('Assistant ID for OpenAI'),
USE_CRYPTO_WORKER: Joi.boolean()

View File

@ -1,3 +1,5 @@
import { createHash } from 'node:crypto'
import { worker } from 'workerpool'
import { CONFIG } from '@/config'
@ -14,7 +16,6 @@ import {
crypto_pwhash,
crypto_shorthash,
} from 'sodium-native'
import { createHash } from 'node:crypto'
export const SecretKeyCryptographyCreateKey = (
salt: string,

View File

@ -1,3 +1,5 @@
// eslint-disable-next-line import/no-unassigned-import
import 'openai/shims/node'
import { CONFIG } from '@/config'
import { i18n } from '@/server/localization'
import { backendLogger as logger } from '@/server/logger'