diff --git a/package-lock.json b/package-lock.json index 897f635a..119a4518 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,12 +23,12 @@ "image-size": "1.0.2", "locale": "0.1.0", "node-geocoder": "4.2.0", - "nodemailer": "^6.9.4", + "nodemailer": "6.9.4", "reflect-metadata": "0.1.13", "sharp": "0.31.3", "ts-exif-parser": "0.2.2", "ts-node-iptc": "1.0.11", - "typeconfig": "2.1.0", + "typeconfig": "2.1.2", "typeorm": "0.3.12", "xml2js": "0.4.23" }, @@ -76,7 +76,7 @@ "@types/leaflet.markercluster": "1.5.1", "@types/node": "18.15.0", "@types/node-geocoder": "4.2.0", - "@types/nodemailer": "^6.4.9", + "@types/nodemailer": "6.4.9", "@types/sharp": "0.31.1", "@types/xml2js": "0.4.11", "@typescript-eslint/eslint-plugin": "5.54.1", @@ -21689,9 +21689,9 @@ } }, "node_modules/typeconfig": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.1.0.tgz", - "integrity": "sha512-2Sn2lB8nG9lOvy2jY/4U0HCkqJqc7Fpf8uF5hXaB/+YVnjexX05bfOxUpxIB0fh+Qob7TrVkHxt/2R3aacj8Cw==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.1.2.tgz", + "integrity": "sha512-4Zw3q9LmJ3OeVFMxpvbRYpcrR5mG7TTZUr+bYPepXvWCuqLC4fXLD+cjS1hl8e1oSmum6Xfl4vheFx33VevlqA==", "dependencies": { "minimist": "1.2.8" } @@ -39769,9 +39769,9 @@ } }, "typeconfig": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.1.0.tgz", - "integrity": "sha512-2Sn2lB8nG9lOvy2jY/4U0HCkqJqc7Fpf8uF5hXaB/+YVnjexX05bfOxUpxIB0fh+Qob7TrVkHxt/2R3aacj8Cw==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/typeconfig/-/typeconfig-2.1.2.tgz", + "integrity": "sha512-4Zw3q9LmJ3OeVFMxpvbRYpcrR5mG7TTZUr+bYPepXvWCuqLC4fXLD+cjS1hl8e1oSmum6Xfl4vheFx33VevlqA==", "requires": { "minimist": "1.2.8" } diff --git a/package.json b/package.json index f9079d42..997e9338 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "sharp": "0.31.3", "ts-exif-parser": "0.2.2", "ts-node-iptc": "1.0.11", - "typeconfig": "2.1.0", + "typeconfig": "2.1.2", "typeorm": "0.3.12", "xml2js": "0.4.23" }, diff --git a/src/common/config/private/Config.ts b/src/common/config/private/Config.ts index b7f980d8..97c22eed 100644 --- a/src/common/config/private/Config.ts +++ b/src/common/config/private/Config.ts @@ -18,7 +18,8 @@ const isTesting = ['afterEach', 'after', 'beforeEach', 'before', 'describe', 'it .every((fn) => (global as any)[fn] instanceof Function); @ConfigClass & ServerConfig>({ - configPath: path.join(__dirname, !isTesting ? './../../../../config.json' : './../../../../test/backend/assets/config.json'), + configPath: path.join(__dirname, !isTesting ? './../../../../config.json' : './../../../../test/backend/tmp/config.json'), + crateConfigPathIfNotExists: isTesting, saveIfNotExist: true, attachDescription: true, enumsAsString: true, @@ -84,7 +85,7 @@ export class PrivateConfigClass extends ServerConfig { console.log('CONFIG', ServerEnvironment); if (typeof ServerEnvironment.sendMailAvailable !== 'undefined') { this.Environment.sendMailAvailable = ServerEnvironment.sendMailAvailable; - if(!this.Environment.sendMailAvailable){ //onNewValue is not yet available as a callback + if (!this.Environment.sendMailAvailable) { //onNewValue is not yet available as a callback this.Messaging.Email.type = EmailMessagingType.SMTP; } } diff --git a/test/backend/unit/middlewares/admin/SettingsMWs.ts b/test/backend/unit/middlewares/admin/SettingsMWs.ts index cece9829..1874987a 100644 --- a/test/backend/unit/middlewares/admin/SettingsMWs.ts +++ b/test/backend/unit/middlewares/admin/SettingsMWs.ts @@ -9,6 +9,8 @@ import {UserRoles} from '../../../../../src/common/entities/UserDTO'; import {ConfigClassBuilder} from '../../../../../node_modules/typeconfig/node'; import {ServerEnvironment} from '../../../../../src/backend/Environment'; import {EmailMessagingType} from '../../../../../src/common/config/private/MessagingConfig'; +import * as fs from 'fs'; +import * as path from 'path'; declare const describe: any; @@ -17,8 +19,10 @@ declare const beforeEach: any; describe('Settings middleware', () => { - beforeEach(() => { - ObjectManagers.reset(); + const tempDir = path.join(__dirname, '../../../tmp'); + beforeEach(async () => { + await ObjectManagers.reset(); + await fs.promises.rm(tempDir, {recursive: true, force: true}); }); it('should save empty enforced users settings', (done: (err?: any) => void) => {