Skip to content

Commit 03fd1e2

Browse files
committed
Fix for the broken test
1 parent ff59af6 commit 03fd1e2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

browser/main/lib/dataApi/attachmentManagement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function removeStorageAndNoteReferences (input, noteKey) {
199199
function deleteAttachmentFolder (storageKey, noteKey) {
200200
const storagePath = findStorage.findStorage(storageKey)
201201
const noteAttachmentPath = path.join(storagePath.path, DESTINATION_FOLDER, noteKey)
202-
sander.rimraf(noteAttachmentPath)
202+
sander.rimrafSync(noteAttachmentPath)
203203
}
204204

205205
module.exports = {

tests/dataApi/deleteNote-test.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ test.serial('Delete a note', (t) => {
4545
.then(function doTest () {
4646
return createNote(storageKey, input1)
4747
.then(function createAttachmentFolder (data) {
48-
fs.mkdirSync(path.join(storagePath.path, attachmentManagement.DESTINATION_FOLDER, data.noteKey))
48+
fs.mkdirSync(path.join(storagePath, attachmentManagement.DESTINATION_FOLDER))
49+
fs.mkdirSync(path.join(storagePath, attachmentManagement.DESTINATION_FOLDER, data.key))
4950
return data
5051
})
5152
.then(function (data) {
@@ -54,15 +55,16 @@ test.serial('Delete a note', (t) => {
5455
})
5556
.then(function assert (data) {
5657
try {
57-
CSON.readFileSync(path.join(storagePath.path, 'notes', data.noteKey + '.cson'))
58+
CSON.readFileSync(path.join(storagePath, 'notes', data.noteKey + '.cson'))
5859
t.fail('note cson must be deleted.')
5960
} catch (err) {
6061
t.is(err.code, 'ENOENT')
62+
return data
6163
}
6264
})
6365
.then(function assertAttachmentFolderDeleted (data) {
64-
const attachmentFolderPath = path.join(storagePath.path, attachmentManagement.DESTINATION_FOLDER, data.noteKey)
65-
t.assert(fs.existsSync(attachmentFolderPath) === false, 'Attachment folder was not deleted')
66+
const attachmentFolderPath = path.join(storagePath, attachmentManagement.DESTINATION_FOLDER, data.noteKey)
67+
t.is(fs.existsSync(attachmentFolderPath), false)
6668
})
6769
})
6870

0 commit comments

Comments
 (0)