import finder from '../finder.mjs' describe('detection in file name', () => { test('detects date in file name', () => { expect(finder .findFormattedDate('2023-06-23T18.36.47 -- machin bidule.jpg') ) .toBe('2023-06-23T18.36.47') }) test('detects jpg file extension in file name', () => { expect(finder .findFileExtension('2023-06-23T18.36.47 -- machin bidule.jpg') ) .toBe('.jpg') }) test('detects JPG file extension in file name', () => { expect(finder .findFileExtension('2023-06-23T18.36.47 -- machin bidule.JPG') ) .toBe('.JPG') }) test('detects correct free text part in file name with a formatted date', () => { expect(finder .findFileNameFreeTextPart('2023-06-23T18.36.47 mon texte libre -- machin bidule.JPG') ) .toBe('mon texte libre') }) test('detects correct free text part in file name', () => { expect(finder .findFileNameFreeTextPart('mon texte libre autre.jpg') ) .toBe('mon texte libre autre') }) test('detects correct correct array of tags in file name', () => { expect(finder .findTagSectionInString('mon texte libre autre - somewhere -- famille vacances plage.jpg') ) .toStrictEqual(['famille', 'vacances', 'plage']) }) }) describe('modification in file name', () => { let fileNameOriginal = 'mon texte -- famille vacances plage.jpg' let properties = finder.destructurateFileName(fileNameOriginal) test('should append to file name in the right place', () => { let modifiedProperties = finder.appendFileName(properties, 'ajouté à la fin du texte libre') expect( modifiedProperties.freeText ) .toBe('mon texte ajouté à la fin du texte libre') }) xtest('should replace text in file name', () => { }) }) xdescribe('modifications with tags', () => { xtest('should add tag in file name', () => { }) xtest('should remove tag in file name', () => { }) xtest('should remove and add tags in file name', () => { }) })