1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-01-26 05:27:35 +02:00

moving config test path

This commit is contained in:
Patrik J. Braun 2023-07-30 19:10:53 +02:00
parent 378f719f9b
commit b8802dbf9e
4 changed files with 19 additions and 14 deletions

18
package-lock.json generated
View File

@ -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"
}

View File

@ -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"
},

View File

@ -18,7 +18,8 @@ const isTesting = ['afterEach', 'after', 'beforeEach', 'before', 'describe', 'it
.every((fn) => (global as any)[fn] instanceof Function);
@ConfigClass<IConfigClass<TAGS> & 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;
}
}

View File

@ -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) => {