@@ -396,8 +396,8 @@ it('should test that moveAttachments returns a correct modified content version'
396
396
} )
397
397
398
398
it ( 'should test that cloneAttachments modifies the content of the new note correctly' , function ( ) {
399
- const oldNote = { key : 'oldNoteKey' , content : 'oldNoteContent' , storage : 'storageKey' }
400
- const newNote = { key : 'newNoteKey' , content : 'oldNoteContent' , storage : 'storageKey' }
399
+ const oldNote = { key : 'oldNoteKey' , content : 'oldNoteContent' , storage : 'storageKey' , type : 'MARKDOWN_NOTE' }
400
+ const newNote = { key : 'newNoteKey' , content : 'oldNoteContent' , storage : 'storageKey' , type : 'MARKDOWN_NOTE' }
401
401
const testInput =
402
402
'Test input' +
403
403
' \n' +
@@ -418,8 +418,8 @@ it('should test that cloneAttachments finds all attachments and copies them to t
418
418
const storagePathNew = 'storagePathNew'
419
419
const dummyStorageOld = { path : storagePathOld }
420
420
const dummyStorageNew = { path : storagePathNew }
421
- const oldNote = { key : 'oldNoteKey' , content : 'oldNoteContent' , storage : 'storageKeyOldNote' }
422
- const newNote = { key : 'newNoteKey' , content : 'oldNoteContent' , storage : 'storageKeyNewNote' }
421
+ const oldNote = { key : 'oldNoteKey' , content : 'oldNoteContent' , storage : 'storageKeyOldNote' , type : 'MARKDOWN_NOTE' }
422
+ const newNote = { key : 'newNoteKey' , content : 'oldNoteContent' , storage : 'storageKeyNewNote' , type : 'MARKDOWN_NOTE' }
423
423
const testInput =
424
424
'Test input' +
425
425
' \n' +
@@ -451,3 +451,19 @@ it('should test that cloneAttachments finds all attachments and copies them to t
451
451
expect ( sander . copyFileSync . mock . calls [ 1 ] [ 0 ] ) . toBe ( pathAttachmentTwoFrom )
452
452
expect ( copyFileSyncResp . to . mock . calls [ 1 ] [ 0 ] ) . toBe ( pathAttachmentTwoTo )
453
453
} )
454
+
455
+ it ( 'should test that cloneAttachments finds all attachments and copies them to the new location' , function ( ) {
456
+ const oldNote = { key : 'oldNoteKey' , content : 'oldNoteContent' , storage : 'storageKeyOldNote' , type : 'SOMETHING_ELSE' }
457
+ const newNote = { key : 'newNoteKey' , content : 'oldNoteContent' , storage : 'storageKeyNewNote' , type : 'SOMETHING_ELSE' }
458
+ const testInput = 'Test input'
459
+ oldNote . content = testInput
460
+ newNote . content = testInput
461
+
462
+ sander . copyFileSync = jest . fn ( )
463
+ findStorage . findStorage = jest . fn ( )
464
+
465
+ systemUnderTest . cloneAttachments ( oldNote , newNote )
466
+
467
+ expect ( findStorage . findStorage ) . not . toHaveBeenCalled ( )
468
+ expect ( sander . copyFileSync ) . not . toHaveBeenCalled ( )
469
+ } )
0 commit comments