mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Merge branch 'master' into Moving_Note_With_Attachment
This commit is contained in:
@@ -8,6 +8,7 @@ jest.mock('unique-slug')
|
||||
const uniqueSlug = require('unique-slug')
|
||||
const mdurl = require('mdurl')
|
||||
const fse = require('fs-extra')
|
||||
const sander = require('sander')
|
||||
|
||||
const systemUnderTest = require('browser/main/lib/dataApi/attachmentManagement')
|
||||
|
||||
@@ -262,6 +263,19 @@ it('should remove the all ":storage" and noteKey references', function () {
|
||||
expect(actual).toEqual(expectedOutput)
|
||||
})
|
||||
|
||||
it('should delete the correct attachment folder if a note is deleted', function () {
|
||||
const dummyStorage = {path: 'dummyStoragePath'}
|
||||
const storageKey = 'storageKey'
|
||||
const noteKey = 'noteKey'
|
||||
findStorage.findStorage = jest.fn(() => dummyStorage)
|
||||
sander.rimrafSync = jest.fn()
|
||||
|
||||
const expectedPathToBeDeleted = path.join(dummyStorage.path, systemUnderTest.DESTINATION_FOLDER, noteKey)
|
||||
systemUnderTest.deleteAttachmentFolder(storageKey, noteKey)
|
||||
expect(findStorage.findStorage).toHaveBeenCalledWith(storageKey)
|
||||
expect(sander.rimrafSync).toHaveBeenCalledWith(expectedPathToBeDeleted)
|
||||
})
|
||||
|
||||
it('should test that deleteAttachmentsNotPresentInNote deletes all unreferenced attachments ', function () {
|
||||
const dummyStorage = {path: 'dummyStoragePath'}
|
||||
const noteKey = 'noteKey'
|
||||
|
||||
Reference in New Issue
Block a user