2023-12-24 18:53:31 +01:00
|
|
|
import finder from './finder.ts'
|
2023-07-01 12:35:33 +02:00
|
|
|
|
|
|
|
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: '',
|
|
|
|
}
|
|
|
|
|
2023-09-10 11:30:50 +02:00
|
|
|
export function TestScreenShotIsFoundAndRenamed () {
|
2023-07-01 12:35:33 +02:00
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-10 11:30:50 +02:00
|
|
|
export function TestTagsAreDetectedInFileName () {
|
2023-07-01 12:35:33 +02:00
|
|
|
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')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-10 11:30:50 +02:00
|
|
|
export function TestFindFormattedDate () {
|
2023-07-01 12:35:33 +02:00
|
|
|
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')
|
|
|
|
}
|
|
|
|
}
|