rangement/utils/testFunctions.mjs

47 lines
1.5 KiB
JavaScript

import finder from './finder.ts'
const pathFolder = '/home/poule/encrypted/stockage-syncable/photos/a_dispatcher/tout'
const sortingFolder = '/home/poule/encrypted/stockage-syncable/photos/a_dispatcher'
const fileDefinition = {
dateStamp: '',
freeText: '',
tags: [],
extension: '',
}
export function TestScreenShotIsFoundAndRenamed () {
let screenShotMockFileName = 'Screenshot 2023-06-15 at 15-28-21 Instance Panoramax OSM-FR.png'
let screenShotMockFileNameExpected = '2023-06-15 at 15-28-21 Instance Panoramax OSM-FR -- screenshot.png'
let found = finder.searchAndRenameScreenshots(screenShotMockFileName)
console.log('found', found)
if (found === screenShotMockFileNameExpected) {
console.log('TestScreenShotIsFoundAndRenamed : test succès')
} else {
console.log('TestScreenShotIsFoundAndRenamed : FAIL:')
console.log(found)
console.log(screenShotMockFileNameExpected)
}
}
export function TestTagsAreDetectedInFileName () {
let mockFileName = '2023-06-15T10:11:12 -- screeenshot festival.png'
let expectedResult = ['screeenshot', 'festival']
let found = finder.findTagSectionInString(mockFileName)
if (found === expectedResult) {
console.info('Succès')
}
}
export function TestFindFormattedDate () {
let mockFileName = 'Capture d\'écran 2023-06-15T10:11:12.png'
let expectedResult = '2023-06-15T10:11:12'
let found = finder.findFormattedDate(mockFileName)
console.log('foundDate', found, expectedResult)
console.log('foundDate', found)
if (found === expectedResult) {
console.info('Succès')
}
}