mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Attachment management should only become active on cloning notes if the note was of type MARKDOWN_NOTE -> No Stacktraces otherwise!
This commit is contained in:
@@ -396,8 +396,8 @@ it('should test that moveAttachments returns a correct modified content version'
|
||||
})
|
||||
|
||||
it('should test that cloneAttachments modifies the content of the new note correctly', function () {
|
||||
const oldNote = {key: 'oldNoteKey', content: 'oldNoteContent', storage: 'storageKey'}
|
||||
const newNote = {key: 'newNoteKey', content: 'oldNoteContent', storage: 'storageKey'}
|
||||
const oldNote = {key: 'oldNoteKey', content: 'oldNoteContent', storage: 'storageKey', type: 'MARKDOWN_NOTE'}
|
||||
const newNote = {key: 'newNoteKey', content: 'oldNoteContent', storage: 'storageKey', type: 'MARKDOWN_NOTE'}
|
||||
const testInput =
|
||||
'Test input' +
|
||||
' \n' +
|
||||
@@ -418,8 +418,8 @@ it('should test that cloneAttachments finds all attachments and copies them to t
|
||||
const storagePathNew = 'storagePathNew'
|
||||
const dummyStorageOld = {path: storagePathOld}
|
||||
const dummyStorageNew = {path: storagePathNew}
|
||||
const oldNote = {key: 'oldNoteKey', content: 'oldNoteContent', storage: 'storageKeyOldNote'}
|
||||
const newNote = {key: 'newNoteKey', content: 'oldNoteContent', storage: 'storageKeyNewNote'}
|
||||
const oldNote = {key: 'oldNoteKey', content: 'oldNoteContent', storage: 'storageKeyOldNote', type: 'MARKDOWN_NOTE'}
|
||||
const newNote = {key: 'newNoteKey', content: 'oldNoteContent', storage: 'storageKeyNewNote', type: 'MARKDOWN_NOTE'}
|
||||
const testInput =
|
||||
'Test input' +
|
||||
' \n' +
|
||||
@@ -451,3 +451,19 @@ it('should test that cloneAttachments finds all attachments and copies them to t
|
||||
expect(sander.copyFileSync.mock.calls[1][0]).toBe(pathAttachmentTwoFrom)
|
||||
expect(copyFileSyncResp.to.mock.calls[1][0]).toBe(pathAttachmentTwoTo)
|
||||
})
|
||||
|
||||
it('should test that cloneAttachments finds all attachments and copies them to the new location', function () {
|
||||
const oldNote = {key: 'oldNoteKey', content: 'oldNoteContent', storage: 'storageKeyOldNote', type: 'SOMETHING_ELSE'}
|
||||
const newNote = {key: 'newNoteKey', content: 'oldNoteContent', storage: 'storageKeyNewNote', type: 'SOMETHING_ELSE'}
|
||||
const testInput = 'Test input'
|
||||
oldNote.content = testInput
|
||||
newNote.content = testInput
|
||||
|
||||
sander.copyFileSync = jest.fn()
|
||||
findStorage.findStorage = jest.fn()
|
||||
|
||||
systemUnderTest.cloneAttachments(oldNote, newNote)
|
||||
|
||||
expect(findStorage.findStorage).not.toHaveBeenCalled()
|
||||
expect(sander.copyFileSync).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user