From e7cb6311a93d2bfdc6d7224591581a12f8156a31 Mon Sep 17 00:00:00 2001 From: Braun Patrik Date: Sun, 4 Jun 2017 18:45:29 +0200 Subject: [PATCH] fixing tests --- backend/model/DiskManger.ts | 19 ++++++++++--------- karma.conf.js | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/backend/model/DiskManger.ts b/backend/model/DiskManger.ts index f7402e53..3f1fcecf 100644 --- a/backend/model/DiskManger.ts +++ b/backend/model/DiskManger.ts @@ -17,13 +17,15 @@ const pool = new Pool(); const LOG_TAG = "[DiskManager]"; +interface PoolInput { + relativeDirectoryName: string; + directoryName: string; + directoryParent: string; + absoluteDirectoryName: string; +} + pool.run( - (input: { - relativeDirectoryName: string, - directoryName: string, - directoryParent: string, - absoluteDirectoryName: string - }, done) => { + (input: PoolInput, done) => { const fs = require("fs"); const path = require("path"); const mime = require("mime"); @@ -153,7 +155,6 @@ pool.run( promises.push(promise); } else if (isImage(fullFilePath)) { - let promise = loadPhotoMetadata(fullFilePath).then((photoMetadata) => { directory.photos.push({ name: file, @@ -161,8 +162,8 @@ pool.run( metadata: photoMetadata }); }); - promises.push(promise); + if (maxPhotos != null && promises.length > maxPhotos) { break; } @@ -224,4 +225,4 @@ export class DiskManager { }); } -} \ No newline at end of file +} diff --git a/karma.conf.js b/karma.conf.js index 685e2d4a..862369fe 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -51,6 +51,7 @@ module.exports = function(config) { {pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false}, //Other libs {pattern: 'node_modules/ng2-cookies/**/*.js', included: false, watched: false}, + {pattern: 'node_modules/typeconfig/**/*.js', included: false, watched: false}, // Paths loaded via module imports: