fix imports in rangement

This commit is contained in:
Tykayn 2023-06-29 18:00:38 +02:00 committed by tykayn
parent 0cf6afa026
commit 64cfe271ca
3 changed files with 12 additions and 6 deletions

View File

@ -1,8 +1,11 @@
/**
* la classe qui repère des patterns
*/
import {tagSectionSeparator} from "./configs";
import {tagSectionSeparator} from "./configs.mjs";
/**
* finds patterns for file name
*/
export default class finders{

View File

@ -6,7 +6,7 @@ import finders from './finders.mjs'
// })
import exifr from 'exifr'
import moment from 'moment'
import {tagSectionSeparator, tagSeparator} from "./configs";
import {tagSectionSeparator, tagSeparator} from "./configs.mjs";
const pathFolder = '/home/poule/encrypted/stockage-syncable/photos/a_dispatcher/tout'
const sortingFolder = '/home/poule/encrypted/stockage-syncable/photos/a_dispatcher'
@ -148,7 +148,7 @@ if (fileMixedNewName !== originalFileName) {
function addTagInFileName(tagName, fileName) {
let tags = findTagSectionInString(fileName)
let firstPart = findFileNameFreeTextPart(fileName)
let firstPart = finders.findFileNameFreeTextPart(fileName)
tags.push(tagName)
let uniqueArray = [...new Set(tags)]
@ -168,7 +168,7 @@ const fileDefinition = {
function destructurateFileName(fileName) {
return {
dateStamp: finders.findFormattedDate(fileName),
freeText: findFileNameFreeTextPart(fileName),
freeText: finders.findFileNameFreeTextPart(fileName),
tags: findTagSectionInString(fileName),
extension: finders.findFileExtension(fileName),
}

View File

@ -1,11 +1,14 @@
// import finders from "./finders.mjs";
const finders = require('./finders.mjs')
import finders from "./finders.mjs";
// const finders = require('./finders.mjs')
describe('rangement file name', () => {
test('detects date in file name', () => {
expect(finders.findFormattedDate('2023-06-23T18.36.47 -- machin bidule.jpg')).toBe('2023-06-23T18.36.47');
});
test('detects file extension in file name', () => {
expect(finders.findFileExtension()('2023-06-23T18.36.47 -- machin bidule.jpg')).toBe('jpg');
});
})
console.log('finders', finders)