mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Merge branch 'master' of https://github.com/BoostIO/Boostnote into paste_storage_link_should_clone_attachment
# Conflicts: # browser/main/lib/dataApi/attachmentManagement.js # locales/da.json # locales/de.json # locales/en.json # locales/es-ES.json # locales/fa.json # locales/fr.json # locales/hu.json # locales/it.json # locales/ja.json # locales/ko.json # locales/no.json # locales/pl.json # locales/pt-BR.json # locales/pt-PT.json # locales/ru.json # locales/sq.json # locales/zh-CN.json # locales/zh-TW.json
This commit is contained in:
@@ -339,6 +339,38 @@ it('should test that deleteAttachmentsNotPresentInNote does not delete reference
|
||||
expect(fsUnlinkCallArguments.includes(path.join(attachmentFolderPath, dummyFilesInFolder[0]))).toBe(false)
|
||||
})
|
||||
|
||||
it('should test that deleteAttachmentsNotPresentInNote does nothing if noteKey, storageKey or noteContent was null', function () {
|
||||
const noteKey = null
|
||||
const storageKey = null
|
||||
const markdownContent = ''
|
||||
|
||||
findStorage.findStorage = jest.fn()
|
||||
fs.existsSync = jest.fn()
|
||||
fs.readdir = jest.fn()
|
||||
fs.unlink = jest.fn()
|
||||
|
||||
systemUnderTest.deleteAttachmentsNotPresentInNote(markdownContent, storageKey, noteKey)
|
||||
expect(fs.existsSync).not.toHaveBeenCalled()
|
||||
expect(fs.readdir).not.toHaveBeenCalled()
|
||||
expect(fs.unlink).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should test that deleteAttachmentsNotPresentInNote does nothing if noteKey, storageKey or noteContent was undefined', function () {
|
||||
const noteKey = undefined
|
||||
const storageKey = undefined
|
||||
const markdownContent = ''
|
||||
|
||||
findStorage.findStorage = jest.fn()
|
||||
fs.existsSync = jest.fn()
|
||||
fs.readdir = jest.fn()
|
||||
fs.unlink = jest.fn()
|
||||
|
||||
systemUnderTest.deleteAttachmentsNotPresentInNote(markdownContent, storageKey, noteKey)
|
||||
expect(fs.existsSync).not.toHaveBeenCalled()
|
||||
expect(fs.readdir).not.toHaveBeenCalled()
|
||||
expect(fs.unlink).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should test that moveAttachments moves attachments only if the source folder existed', function () {
|
||||
fse.existsSync = jest.fn(() => false)
|
||||
fse.moveSync = jest.fn()
|
||||
@@ -403,6 +435,8 @@ it('should test that cloneAttachments modifies the content of the new note corre
|
||||
' \n' +
|
||||
'[' + systemUnderTest.STORAGE_FOLDER_PLACEHOLDER + path.sep + oldNote.key + path.sep + 'pdf.pdf](pdf})'
|
||||
newNote.content = testInput
|
||||
findStorage.findStorage = jest.fn()
|
||||
findStorage.findStorage.mockReturnValue({path: 'dummyStoragePath'})
|
||||
|
||||
const expectedOutput =
|
||||
'Test input' +
|
||||
|
||||
Reference in New Issue
Block a user