mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Fix for the broken test
This commit is contained in:
@@ -199,7 +199,7 @@ function removeStorageAndNoteReferences (input, noteKey) {
|
|||||||
function deleteAttachmentFolder (storageKey, noteKey) {
|
function deleteAttachmentFolder (storageKey, noteKey) {
|
||||||
const storagePath = findStorage.findStorage(storageKey)
|
const storagePath = findStorage.findStorage(storageKey)
|
||||||
const noteAttachmentPath = path.join(storagePath.path, DESTINATION_FOLDER, noteKey)
|
const noteAttachmentPath = path.join(storagePath.path, DESTINATION_FOLDER, noteKey)
|
||||||
sander.rimraf(noteAttachmentPath)
|
sander.rimrafSync(noteAttachmentPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ test.serial('Delete a note', (t) => {
|
|||||||
.then(function doTest () {
|
.then(function doTest () {
|
||||||
return createNote(storageKey, input1)
|
return createNote(storageKey, input1)
|
||||||
.then(function createAttachmentFolder (data) {
|
.then(function createAttachmentFolder (data) {
|
||||||
fs.mkdirSync(path.join(storagePath.path, attachmentManagement.DESTINATION_FOLDER, data.noteKey))
|
fs.mkdirSync(path.join(storagePath, attachmentManagement.DESTINATION_FOLDER))
|
||||||
|
fs.mkdirSync(path.join(storagePath, attachmentManagement.DESTINATION_FOLDER, data.key))
|
||||||
return data
|
return data
|
||||||
})
|
})
|
||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
@@ -54,15 +55,16 @@ test.serial('Delete a note', (t) => {
|
|||||||
})
|
})
|
||||||
.then(function assert (data) {
|
.then(function assert (data) {
|
||||||
try {
|
try {
|
||||||
CSON.readFileSync(path.join(storagePath.path, 'notes', data.noteKey + '.cson'))
|
CSON.readFileSync(path.join(storagePath, 'notes', data.noteKey + '.cson'))
|
||||||
t.fail('note cson must be deleted.')
|
t.fail('note cson must be deleted.')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
t.is(err.code, 'ENOENT')
|
t.is(err.code, 'ENOENT')
|
||||||
|
return data
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function assertAttachmentFolderDeleted (data) {
|
.then(function assertAttachmentFolderDeleted (data) {
|
||||||
const attachmentFolderPath = path.join(storagePath.path, attachmentManagement.DESTINATION_FOLDER, data.noteKey)
|
const attachmentFolderPath = path.join(storagePath, attachmentManagement.DESTINATION_FOLDER, data.noteKey)
|
||||||
t.assert(fs.existsSync(attachmentFolderPath) === false, 'Attachment folder was not deleted')
|
t.is(fs.existsSync(attachmentFolderPath), false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user