From 217d9de76113fdd1f3043afd0e1112391f2c0edb Mon Sep 17 00:00:00 2001 From: Tykayn Date: Wed, 19 Jul 2023 10:57:07 +0200 Subject: [PATCH] add dev script --- development.sh | 12 ++++++++++++ tests/finder.test.js | 7 +++++++ utils/finder.mjs | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 development.sh diff --git a/development.sh b/development.sh new file mode 100644 index 0000000..2ef4de4 --- /dev/null +++ b/development.sh @@ -0,0 +1,12 @@ +#/bin/bash +# +# ------------------------- +# this should work for dev purposes +# alias should be set in you bash aliases files: +# +# alias range="node /home/poule/encrypted/stockage-syncable/www/development/html/rangement/index.mjs --dry-run=true " +# ------------------------- +range /home/poule/encrypted/stockage-syncable/www/development/html/rangement/testFiles/misnamed_file/2000-01-01T01.01.01\ FyB8cZnWIAc21rw\ --\ meme.jpg + +# you should see that the debug logs find a misnamed file name +# and want to rename it to the 2023 date of modification, not the 2000 year date. \ No newline at end of file diff --git a/tests/finder.test.js b/tests/finder.test.js index d1c82b1..af40e3f 100644 --- a/tests/finder.test.js +++ b/tests/finder.test.js @@ -54,6 +54,13 @@ describe('modification in file name', () => { ) .toBe('mon texte ajouté à la fin du texte libre') }) + test('should prepend to file name in the right place', () => { + let modifiedProperties = finder.prependFileName(properties, 'ajouté au début du texte libre ') + expect( + modifiedProperties.freeText + ) + .toBe('ajouté au début du texte libre mon texte') + }) test('should replace text in file name', () => { let searchString = 'vacances', replaceString = 'machin' let replacedString = finder.searchAndReplaceInFileName(searchString, replaceString, fileNameOriginal) diff --git a/utils/finder.mjs b/utils/finder.mjs index 6140b51..730ccbc 100644 --- a/utils/finder.mjs +++ b/utils/finder.mjs @@ -220,6 +220,7 @@ export default class finder { * @returns {string} */ static findEarliestDateInExifData (exifData) { + log.debug(' finder - findEarliestDateInExifData') if (exifData) { let moments = [] @@ -263,7 +264,7 @@ export default class finder { return minDate.format(rangement_instance.iso_date_format) } else { - log.debug(' finder - pas de exif data') + log.debug(' finder - /!\\ pas de exif data') return '' } }