You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-12-18 00:19:25 +02:00
Loading default settings before evaluating MetadataLoader
This commit is contained in:
@@ -15,5 +15,6 @@ before_install:
|
|||||||
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
|
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
|
||||||
install:
|
install:
|
||||||
- npm ci
|
- npm ci
|
||||||
|
- npm run lint
|
||||||
- npm run build
|
- npm run build
|
||||||
after_success: npm run coverage
|
after_success: npm run coverage
|
||||||
|
|||||||
@@ -216,13 +216,13 @@ export class MetadataLoader {
|
|||||||
if (exif.Rating) {
|
if (exif.Rating) {
|
||||||
metadata.rating = (parseInt(exif.Rating.value, 10) as any);
|
metadata.rating = (parseInt(exif.Rating.value, 10) as any);
|
||||||
}
|
}
|
||||||
if(exif.subject && exif.subject.value && exif.subject.value.length > 0){
|
if (exif.subject && exif.subject.value && exif.subject.value.length > 0) {
|
||||||
if(metadata.keywords == undefined) {
|
if (metadata.keywords == undefined) {
|
||||||
metadata.keywords = [];
|
metadata.keywords = [];
|
||||||
}
|
}
|
||||||
for(let i=0; i < exif.subject.value.length; i++){
|
for (let i = 0; i < exif.subject.value.length; i++) {
|
||||||
const kw = exif.subject.value[i].description;
|
const kw = exif.subject.value[i].description;
|
||||||
if(metadata.keywords.indexOf(kw) == -1) {
|
if (metadata.keywords.indexOf(kw) == -1) {
|
||||||
metadata.keywords.push(kw);
|
metadata.keywords.push(kw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ describe('SettingsRouter', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('/GET settings', () => {
|
describe('/GET settings', () => {
|
||||||
it('it should GET all the books', async () => {
|
it('it should GET the settings', async () => {
|
||||||
Config.Client.authenticationRequired = false;
|
Config.Client.authenticationRequired = false;
|
||||||
const originalSettings = await Config.original();
|
const originalSettings = await Config.original();
|
||||||
originalSettings.Server.sessionSecret = null;
|
originalSettings.Server.sessionSecret = null;
|
||||||
|
|||||||
@@ -4,8 +4,11 @@ import {Utils} from '../../../../../src/common/Utils';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import {PhotoProcessing} from '../../../../../src/backend/model/fileprocessing/PhotoProcessing';
|
import {PhotoProcessing} from '../../../../../src/backend/model/fileprocessing/PhotoProcessing';
|
||||||
|
import {Config} from '../../../../../src/common/config/private/Config';
|
||||||
|
|
||||||
describe('MetadataLoader', () => {
|
describe('MetadataLoader', () => {
|
||||||
|
// loading default settings (this might have been changed by other tests
|
||||||
|
Config.loadSync();
|
||||||
|
|
||||||
it('should load png', async () => {
|
it('should load png', async () => {
|
||||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/test_png.png'));
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/test_png.png'));
|
||||||
|
|||||||
Reference in New Issue
Block a user